home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: TADSLANG.TEX
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document, ASCII text, with CRLF line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| x-fmt/111 Plain Text File
| default
| |
100%
| detectItEasy
| Format: plain text[CRLF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 24 48 65 61 64 65 | 72 3a 20 63 3a 2f 74 61 |% $Heade|r: c:/ta|
|00000010| 64 73 2f 64 6f 63 2f 52 | 43 53 2f 74 61 64 73 6c |ds/doc/R|CS/tadsl|
|00000020| 61 6e 67 2e 74 65 78 20 | 31 2e 32 20 39 32 2f 31 |ang.tex |1.2 92/1|
|00000030| 31 2f 31 33 20 31 36 3a | 34 35 3a 30 35 20 6d 72 |1/13 16:|45:05 mr|
|00000040| 6f 62 65 72 74 73 20 45 | 78 70 20 24 0d 0a 25 0d |oberts E|xp $..%.|
|00000050| 0a 25 20 54 41 44 53 20 | 44 6f 63 75 6d 65 6e 74 |.% TADS |Document|
|00000060| 61 74 69 6f 6e 2c 20 43 | 68 61 70 74 65 72 20 54 |ation, C|hapter T|
|00000070| 68 72 65 65 3a 20 20 4c | 61 6e 67 75 61 67 65 20 |hree: L|anguage |
|00000080| 4f 76 65 72 76 69 65 77 | 0d 0a 25 0d 0a 25 20 43 |Overview|..%..% C|
|00000090| 6f 70 79 72 69 67 68 74 | 20 28 63 29 20 31 39 38 |opyright| (c) 198|
|000000a0| 39 20 62 79 20 4d 69 63 | 68 61 65 6c 20 4a 2e 20 |9 by Mic|hael J. |
|000000b0| 52 6f 62 65 72 74 73 2e | 20 20 41 6c 6c 20 52 69 |Roberts.| All Ri|
|000000c0| 67 68 74 73 20 52 65 73 | 65 72 76 65 64 2e 0d 0a |ghts Res|erved...|
|000000d0| 25 0d 0a 0d 0a 5c 63 68 | 61 70 74 65 72 68 65 61 |%....\ch|apterhea|
|000000e0| 64 65 72 7b 43 68 61 70 | 74 65 72 20 54 68 72 65 |der{Chap|ter Thre|
|000000f0| 65 7d 7b 4c 61 6e 67 75 | 61 67 65 20 4f 76 65 72 |e}{Langu|age Over|
|00000100| 76 69 65 77 7d 7b 33 7d | 0d 0a 0d 0a 54 68 65 20 |view}{3}|....The |
|00000110| 54 65 78 74 20 41 64 76 | 65 6e 74 75 72 65 20 44 |Text Adv|enture D|
|00000120| 65 76 65 6c 6f 70 6d 65 | 6e 74 20 53 79 73 74 65 |evelopme|nt Syste|
|00000130| 6d 0d 0a 6f 66 66 65 72 | 73 20 67 61 6d 65 20 61 |m..offer|s game a|
|00000140| 75 74 68 6f 72 73 20 61 | 20 76 65 72 73 61 74 69 |uthors a| versati|
|00000150| 6c 65 20 61 6e 64 20 70 | 6f 77 65 72 66 75 6c 0d |le and p|owerful.|
|00000160| 0a 6c 61 6e 67 75 61 67 | 65 2c 20 77 65 6c 6c 20 |.languag|e, well |
|00000170| 73 75 69 74 65 64 20 74 | 6f 20 63 72 65 61 74 69 |suited t|o creati|
|00000180| 6e 67 20 74 68 65 20 77 | 6f 72 6c 64 20 6d 6f 64 |ng the w|orld mod|
|00000190| 65 6c 73 20 74 68 61 74 | 20 75 6e 64 65 72 6c 69 |els that| underli|
|000001a0| 65 20 74 65 78 74 0d 0a | 61 64 76 65 6e 74 75 72 |e text..|adventur|
|000001b0| 65 20 67 61 6d 65 73 2e | 0d 0a 0d 0a 54 68 65 20 |e games.|....The |
|000001c0| 54 41 44 53 20 6c 61 6e | 67 75 61 67 65 20 69 73 |TADS lan|guage is|
|000001d0| 20 61 20 70 6f 77 65 72 | 66 75 6c 20 6f 62 6a 65 | a power|ful obje|
|000001e0| 63 74 2d 6f 72 69 65 6e | 74 65 64 20 6c 61 6e 67 |ct-orien|ted lang|
|000001f0| 75 61 67 65 20 62 61 73 | 65 64 20 6f 6e 20 43 2e |uage bas|ed on C.|
|00000200| 0d 0a 54 41 44 53 20 75 | 73 65 73 20 6d 6f 73 74 |..TADS u|ses most|
|00000210| 20 6f 66 20 74 68 65 20 | 73 61 6d 65 20 6b 65 79 | of the |same key|
|00000220| 77 6f 72 64 73 20 61 6e | 64 20 6f 70 65 72 61 74 |words an|d operat|
|00000230| 6f 72 73 20 61 73 20 43 | 2c 20 62 75 74 20 68 61 |ors as C|, but ha|
|00000240| 73 20 61 0d 0a 66 65 77 | 20 63 68 61 6e 67 65 73 |s a..few| changes|
|00000250| 20 74 68 61 74 20 6d 61 | 6b 65 20 69 74 20 65 61 | that ma|ke it ea|
|00000260| 73 69 65 72 20 74 6f 20 | 75 73 65 2e 20 20 54 41 |sier to |use. TA|
|00000270| 44 53 20 61 6c 73 6f 20 | 75 73 65 73 20 60 60 72 |DS also |uses ``r|
|00000280| 75 6e 2d 74 69 6d 65 0d | 0a 74 79 70 69 6e 67 2c |un-time.|.typing,|
|00000290| 27 27 20 77 68 69 63 68 | 20 6d 65 61 6e 73 20 74 |'' which| means t|
|000002a0| 68 61 74 20 79 6f 75 20 | 64 6f 6e 27 74 20 68 61 |hat you |don't ha|
|000002b0| 76 65 20 74 6f 20 64 65 | 63 6c 61 72 65 20 69 6e |ve to de|clare in|
|000002c0| 20 61 64 76 61 6e 63 65 | 20 74 68 65 0d 0a 64 61 | advance| the..da|
|000002d0| 74 61 74 79 70 65 73 20 | 6f 66 20 79 6f 75 72 20 |tatypes |of your |
|000002e0| 76 61 72 69 61 62 6c 65 | 73 2c 20 66 75 6e 63 74 |variable|s, funct|
|000002f0| 69 6f 6e 73 2c 20 61 6e | 64 20 70 72 6f 70 65 72 |ions, an|d proper|
|00000300| 74 69 65 73 2e 20 20 49 | 6e 0d 0a 61 64 64 69 74 |ties. I|n..addit|
|00000310| 69 6f 6e 2c 20 54 41 44 | 53 20 68 61 73 20 68 69 |ion, TAD|S has hi|
|00000320| 67 68 2d 6c 65 76 65 6c | 20 64 61 74 61 74 79 70 |gh-level| datatyp|
|00000330| 65 73 2c 20 73 75 63 68 | 20 61 73 20 6c 69 73 74 |es, such| as list|
|00000340| 73 20 61 6e 64 20 73 74 | 72 69 6e 67 73 2c 0d 0a |s and st|rings,..|
|00000350| 74 68 61 74 20 6d 61 6b | 65 20 6d 65 6d 6f 72 79 |that mak|e memory|
|00000360| 20 6d 61 6e 61 67 65 6d | 65 6e 74 20 74 6f 74 61 | managem|ent tota|
|00000370| 6c 6c 79 20 61 75 74 6f | 6d 61 74 69 63 2e 0d 0a |lly auto|matic...|
|00000380| 0d 0a 54 68 69 73 20 63 | 68 61 70 74 65 72 20 70 |..This c|hapter p|
|00000390| 72 6f 76 69 64 65 73 20 | 61 6e 20 6f 76 65 72 76 |rovides |an overv|
|000003a0| 69 65 77 20 6f 66 20 74 | 68 65 20 67 65 6e 65 72 |iew of t|he gener|
|000003b0| 61 6c 20 66 65 61 74 75 | 72 65 73 0d 0a 6f 66 20 |al featu|res..of |
|000003c0| 74 68 65 20 6c 61 6e 67 | 75 61 67 65 2e 5c 62 75 |the lang|uage.\bu|
|000003d0| 6c 6c 0d 0a 0d 0a 5c 63 | 68 61 70 74 65 72 62 6f |ll....\c|hapterbo|
|000003e0| 64 79 0d 0a 0d 0a 0d 0a | 5c 6d 61 6a 6f 72 73 65 |dy......|\majorse|
|000003f0| 63 74 69 6f 6e 20 46 75 | 6e 63 74 69 6f 6e 73 0d |ction Fu|nctions.|
|00000400| 0a 0d 0a 46 75 6e 63 74 | 69 6f 6e 73 20 77 69 6c |...Funct|ions wil|
|00000410| 6c 20 62 65 20 66 61 6d | 69 6c 69 61 72 20 74 6f |l be fam|iliar to|
|00000420| 20 75 73 65 72 73 20 6f | 66 20 6c 61 6e 67 75 61 | users o|f langua|
|00000430| 67 65 73 20 73 75 63 68 | 20 61 73 20 5e 7b 43 7d |ges such| as ^{C}|
|00000440| 20 61 6e 64 20 5e 7b 50 | 61 73 63 61 6c 7d 2e 20 | and ^{P|ascal}. |
|00000450| 41 0d 0a 5e 7b 66 75 6e | 63 74 69 6f 6e 7d 20 69 |A..^{fun|ction} i|
|00000460| 73 20 61 20 62 69 74 20 | 6f 66 20 63 6f 64 65 20 |s a bit |of code |
|00000470| 74 68 61 74 20 69 73 20 | 67 72 6f 75 70 65 64 20 |that is |grouped |
|00000480| 74 6f 67 65 74 68 65 72 | 20 61 6e 64 20 67 69 76 |together| and giv|
|00000490| 65 6e 20 61 20 6e 61 6d | 65 3b 20 61 6e 6f 74 68 |en a nam|e; anoth|
|000004a0| 65 72 0d 0a 70 61 72 74 | 20 6f 66 20 79 6f 75 72 |er..part| of your|
|000004b0| 20 70 72 6f 67 72 61 6d | 20 63 61 6e 20 63 61 75 | program| can cau|
|000004c0| 73 65 20 61 20 66 75 6e | 63 74 69 6f 6e 20 74 6f |se a fun|ction to|
|000004d0| 20 63 61 72 72 79 20 6f | 75 74 20 69 74 73 20 63 | carry o|ut its c|
|000004e0| 6f 64 65 20 62 79 20 63 | 61 6c 6c 69 6e 67 20 69 |ode by c|alling i|
|000004f0| 74 2e 0d 0a 54 68 69 73 | 20 69 73 20 61 6e 20 65 |t...This| is an e|
|00000500| 78 61 6d 70 6c 65 20 6f | 66 20 61 20 66 75 6e 63 |xample o|f a func|
|00000510| 74 69 6f 6e 20 69 6e 20 | 54 41 44 53 3a 0d 0a 0d |tion in |TADS:...|
|00000520| 0a 7b 5c 65 78 61 6d 70 | 6c 65 0d 0a 20 20 20 20 |.{\examp|le.. |
|00000530| 73 68 6f 77 53 75 6d 3a | 20 66 75 6e 63 74 69 6f |showSum:| functio|
|00000540| 6e 28 61 72 67 31 2c 20 | 61 72 67 32 2c 20 61 72 |n(arg1, |arg2, ar|
|00000550| 67 33 29 0d 0a 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |g3).. | \lb.. |
|00000560| 20 20 20 20 20 20 22 54 | 68 65 20 73 75 6d 20 69 | "T|he sum i|
|00000570| 73 3a 20 22 3b 0d 0a 20 | 20 20 20 20 20 20 20 73 |s: ";.. | s|
|00000580| 61 79 28 61 72 67 31 20 | 2b 20 61 72 67 32 20 2b |ay(arg1 |+ arg2 +|
|00000590| 20 61 72 67 33 29 3b 0d | 0a 20 20 20 20 20 20 20 | arg3);.|. |
|000005a0| 20 22 5c 63 68 61 72 60 | 5c 5c 6e 22 3b 0d 0a 20 | "\char`|\\n";.. |
|000005b0| 20 20 20 5c 72 62 0d 0a | 7d 0d 0a 0d 0a 54 68 69 | \rb..|}....Thi|
|000005c0| 73 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 63 61 |s functi|on is ca|
|000005d0| 6c 6c 65 64 20 7b 5c 74 | 74 20 73 68 6f 77 53 75 |lled {\t|t showSu|
|000005e0| 6d 7d 2e 20 41 20 66 75 | 6e 63 74 69 6f 6e 20 6e |m}. A fu|nction n|
|000005f0| 61 6d 65 20 63 61 6e 20 | 62 65 20 61 6e 79 20 63 |ame can |be any c|
|00000600| 6f 6d 62 69 6e 61 74 69 | 6f 6e 0d 0a 6f 66 20 6c |ombinati|on..of l|
|00000610| 65 74 74 65 72 73 0d 0a | 61 6e 64 20 6e 75 6d 62 |etters..|and numb|
|00000620| 65 72 73 2c 20 62 75 74 | 20 6d 75 73 74 20 73 74 |ers, but| must st|
|00000630| 61 72 74 20 77 69 74 68 | 20 61 20 6c 65 74 74 65 |art with| a lette|
|00000640| 72 2e 20 20 43 61 70 69 | 74 61 6c 20 61 6e 64 20 |r. Capi|tal and |
|00000650| 6c 6f 77 65 72 2d 63 61 | 73 65 20 6c 65 74 74 65 |lower-ca|se lette|
|00000660| 72 73 20 61 72 65 0d 0a | 64 69 66 66 65 72 65 6e |rs are..|differen|
|00000670| 74 20 69 6e 20 54 41 44 | 53 2c 20 73 6f 20 7b 5c |t in TAD|S, so {\|
|00000680| 74 74 20 73 68 6f 77 53 | 75 6d 7d 20 69 73 20 61 |tt showS|um} is a|
|00000690| 20 64 69 73 74 69 6e 63 | 74 20 66 75 6e 63 74 69 | distinc|t functi|
|000006a0| 6f 6e 20 66 72 6f 6d 0d | 0a 7b 5c 74 74 20 73 68 |on from.|.{\tt sh|
|000006b0| 6f 77 73 75 6d 7d 20 61 | 6e 64 20 7b 5c 74 74 20 |owsum} a|nd {\tt |
|000006c0| 53 68 6f 77 53 75 6d 7d | 2e 0d 0a 0d 0a 54 68 65 |ShowSum}|.....The|
|000006d0| 20 5e 7b 63 75 72 6c 79 | 20 62 72 61 63 65 73 7d | ^{curly| braces}|
|000006e0| 20 69 6e 64 69 63 61 74 | 65 20 77 68 65 72 65 20 | indicat|e where |
|000006f0| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 73 74 61 |the func|tion sta|
|00000700| 72 74 73 20 61 6e 64 20 | 65 6e 64 73 3b 0d 0a 74 |rts and |ends;..t|
|00000710| 68 65 20 63 6f 64 65 20 | 69 6e 73 69 64 65 0d 0a |he code |inside..|
|00000720| 69 73 20 74 68 65 20 62 | 6f 64 79 20 6f 66 20 74 |is the b|ody of t|
|00000730| 68 65 20 66 75 6e 63 74 | 69 6f 6e 2c 20 61 6e 64 |he funct|ion, and|
|00000740| 20 69 73 20 65 78 65 63 | 75 74 65 64 20 65 61 63 | is exec|uted eac|
|00000750| 68 20 74 69 6d 65 20 74 | 68 65 20 66 75 6e 63 74 |h time t|he funct|
|00000760| 69 6f 6e 20 69 73 20 63 | 61 6c 6c 65 64 2e 0d 0a |ion is c|alled...|
|00000770| 0d 0a 54 68 65 20 69 74 | 65 6d 73 20 69 6e 20 70 |..The it|ems in p|
|00000780| 61 72 65 6e 74 68 65 73 | 65 73 2c 20 7b 5c 74 74 |arenthes|es, {\tt|
|00000790| 20 61 72 67 31 7d 2c 20 | 7b 5c 74 74 20 61 72 67 | arg1}, |{\tt arg|
|000007a0| 32 7d 2c 20 61 6e 64 20 | 7b 5c 74 74 20 61 72 67 |2}, and |{\tt arg|
|000007b0| 33 7d 2c 0d 0a 61 72 65 | 20 74 68 65 20 7b 5c 73 |3},..are| the {\s|
|000007c0| 6c 20 5e 7b 61 72 67 75 | 6d 65 6e 74 73 7d 7d 20 |l ^{argu|ments}} |
|000007d0| 74 6f 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 2e |to the f|unction.|
|000007e0| 0d 0a 53 6f 6d 65 20 66 | 75 6e 63 74 69 6f 6e 73 |..Some f|unctions|
|000007f0| 20 68 61 76 65 20 6e 6f | 20 61 72 67 75 6d 65 6e | have no| argumen|
|00000800| 74 73 20 61 74 20 61 6c | 6c 3b 20 66 6f 72 20 74 |ts at al|l; for t|
|00000810| 68 65 73 65 20 66 75 6e | 63 74 69 6f 6e 73 2c 0d |hese fun|ctions,.|
|00000820| 0a 74 68 65 20 70 61 72 | 65 6e 74 68 65 73 65 73 |.the par|entheses|
|00000830| 20 61 6e 64 20 61 72 67 | 75 6d 65 6e 74 20 6c 69 | and arg|ument li|
|00000840| 73 74 20 61 72 65 20 6e | 6f 74 20 70 72 65 73 65 |st are n|ot prese|
|00000850| 6e 74 2e 0d 0a 57 68 65 | 6e 20 74 68 65 20 66 75 |nt...Whe|n the fu|
|00000860| 6e 63 74 69 6f 6e 20 69 | 73 20 63 61 6c 6c 65 64 |nction i|s called|
|00000870| 2c 20 76 61 6c 75 65 73 | 20 61 72 65 20 73 70 65 |, values| are spe|
|00000880| 63 69 66 69 65 64 20 66 | 6f 72 20 74 68 65 20 61 |cified f|or the a|
|00000890| 72 67 75 6d 65 6e 74 73 | 2e 20 20 46 6f 72 0d 0a |rguments|. For..|
|000008a0| 65 78 61 6d 70 6c 65 2c | 20 69 66 20 74 68 65 20 |example,| if the |
|000008b0| 66 6f 6c 6c 6f 77 69 6e | 67 20 63 6f 64 65 20 69 |followin|g code i|
|000008c0| 73 20 65 78 65 63 75 74 | 65 64 3a 0d 0a 0d 0a 7b |s execut|ed:....{|
|000008d0| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 20 73 68 |\example|.. sh|
|000008e0| 6f 77 73 75 6d 28 31 2c | 20 32 2c 20 33 29 3b 0d |owsum(1,| 2, 3);.|
|000008f0| 0a 20 20 20 20 73 68 6f | 77 73 75 6d 28 39 2c 20 |. sho|wsum(9, |
|00000900| 38 2c 20 37 29 3b 0d 0a | 7d 0d 0a 0d 0a 74 68 65 |8, 7);..|}....the|
|00000910| 6e 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 69 |n the fu|nction i|
|00000920| 73 20 63 61 6c 6c 65 64 | 20 74 77 69 63 65 3a 20 |s called| twice: |
|00000930| 20 74 68 65 20 66 69 72 | 73 74 20 74 69 6d 65 2c | the fir|st time,|
|00000940| 20 74 68 65 20 76 61 6c | 75 65 73 20 6f 66 20 7b | the val|ues of {|
|00000950| 5c 74 74 20 61 72 67 31 | 7d 2c 0d 0a 7b 5c 74 74 |\tt arg1|},..{\tt|
|00000960| 20 61 72 67 32 7d 2c 20 | 61 6e 64 20 7b 5c 74 74 | arg2}, |and {\tt|
|00000970| 20 61 72 67 33 7d 2c 20 | 72 65 73 70 65 63 74 69 | arg3}, |respecti|
|00000980| 76 65 6c 79 2c 20 61 72 | 65 20 31 2c 20 32 2c 20 |vely, ar|e 1, 2, |
|00000990| 61 6e 64 20 33 3b 20 74 | 68 65 20 73 65 63 6f 6e |and 3; t|he secon|
|000009a0| 64 20 74 69 6d 65 2c 0d | 0a 74 68 65 79 20 61 72 |d time,.|.they ar|
|000009b0| 65 20 39 2c 20 38 2c 20 | 61 6e 64 20 37 2e 20 20 |e 9, 8, |and 7. |
|000009c0| 54 68 65 20 6f 75 74 70 | 75 74 20 69 73 20 74 68 |The outp|ut is th|
|000009d0| 75 73 3a 0d 0a 0d 0a 7b | 5c 65 78 61 6d 70 6c 65 |us:....{|\example|
|000009e0| 0d 0a 20 20 20 20 54 68 | 65 20 73 75 6d 20 69 73 |.. Th|e sum is|
|000009f0| 3a 20 36 0d 0a 20 20 20 | 20 54 68 65 20 73 75 6d |: 6.. | The sum|
|00000a00| 20 69 73 3a 20 32 34 0d | 0a 7d 0d 0a 0d 0a 54 68 | is: 24.|.}....Th|
|00000a10| 65 0d 0a 61 72 67 75 6d | 65 6e 74 73 20 61 72 65 |e..argum|ents are|
|00000a20| 20 65 6e 74 69 72 65 6c | 79 20 60 60 5e 7b 6c 6f | entirel|y ``^{lo|
|00000a30| 63 61 6c 7d 22 20 74 6f | 20 74 68 65 20 66 75 6e |cal}" to| the fun|
|00000a40| 63 74 69 6f 6e 3b 20 7b | 5c 74 74 20 61 72 67 31 |ction; {|\tt arg1|
|00000a50| 7d 20 69 73 20 6d 65 61 | 6e 69 6e 67 66 75 6c 0d |} is mea|ningful.|
|00000a60| 0a 6f 6e 6c 79 20 77 69 | 74 68 69 6e 20 74 68 65 |.only wi|thin the|
|00000a70| 20 66 75 6e 63 74 69 6f | 6e 20 7b 5c 74 74 20 73 | functio|n {\tt s|
|00000a80| 68 6f 77 53 75 6d 7d 2e | 20 20 54 68 65 20 66 75 |howSum}.| The fu|
|00000a90| 6e 63 74 69 6f 6e 20 63 | 61 6e 20 61 6c 73 6f 20 |nction c|an also |
|00000aa0| 64 65 66 69 6e 65 20 6c | 6f 63 61 6c 0d 0a 76 61 |define l|ocal..va|
|00000ab0| 72 69 61 62 6c 65 73 20 | 6f 66 20 69 74 73 20 6f |riables |of its o|
|00000ac0| 77 6e 20 77 69 74 68 20 | 74 68 65 20 7b 5c 74 74 |wn with |the {\tt|
|00000ad0| 20 6c 6f 63 61 6c 7d 20 | 73 74 61 74 65 6d 65 6e | local} |statemen|
|00000ae0| 74 3b 20 74 68 69 73 20 | 69 73 20 65 78 70 6c 61 |t; this |is expla|
|00000af0| 69 6e 65 64 20 69 6e 0d | 0a 6d 6f 72 65 20 64 65 |ined in.|.more de|
|00000b00| 74 61 69 6c 20 6c 61 74 | 65 72 2e 0d 0a 0d 0a 46 |tail lat|er.....F|
|00000b10| 75 6e 63 74 69 6f 6e 73 | 20 63 61 6e 20 64 6f 20 |unctions| can do |
|00000b20| 61 20 67 72 65 61 74 20 | 64 65 61 6c 20 6d 6f 72 |a great |deal mor|
|00000b30| 65 20 74 68 61 6e 20 6a | 75 73 74 20 64 69 73 70 |e than j|ust disp|
|00000b40| 6c 61 79 20 74 68 65 20 | 73 75 6d 20 6f 66 20 74 |lay the |sum of t|
|00000b50| 68 72 65 65 20 6e 75 6d | 62 65 72 73 2e 0d 0a 54 |hree num|bers...T|
|00000b60| 68 65 20 7b 5c 74 74 20 | 5e 7b 69 66 7d 7d 20 73 |he {\tt |^{if}} s|
|00000b70| 74 61 74 65 6d 65 6e 74 | 20 61 6c 6c 6f 77 73 20 |tatement| allows |
|00000b80| 73 74 61 74 65 6d 65 6e | 74 73 20 74 6f 20 62 65 |statemen|ts to be|
|00000b90| 20 65 78 65 63 75 74 65 | 64 20 63 6f 6e 64 69 74 | execute|d condit|
|00000ba0| 69 6f 6e 61 6c 6c 79 2c | 0d 0a 61 6e 64 20 74 68 |ionally,|..and th|
|00000bb0| 65 20 7b 5c 74 74 20 5e | 7b 77 68 69 6c 65 7d 7d |e {\tt ^|{while}}|
|00000bc0| 20 73 74 61 74 65 6d 65 | 6e 74 20 61 6c 6c 6f 77 | stateme|nt allow|
|00000bd0| 73 20 73 74 61 74 65 6d | 65 6e 74 73 20 74 6f 20 |s statem|ents to |
|00000be0| 62 65 20 65 78 65 63 75 | 74 65 64 20 72 65 70 65 |be execu|ted repe|
|00000bf0| 61 74 65 64 6c 79 2e 0d | 0a 54 41 44 53 20 70 72 |atedly..|.TADS pr|
|00000c00| 6f 76 69 64 65 73 20 66 | 75 6c 6c 20 69 6e 74 65 |ovides f|ull inte|
|00000c10| 67 65 72 20 61 72 69 74 | 68 6d 65 74 69 63 2c 20 |ger arit|hmetic, |
|00000c20| 61 6e 64 20 69 74 20 61 | 6c 73 6f 20 70 72 6f 76 |and it a|lso prov|
|00000c30| 69 64 65 73 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 |ides ope|rations |
|00000c40| 6f 6e 0d 0a 73 74 72 69 | 6e 67 73 20 61 6e 64 20 |on..stri|ngs and |
|00000c50| 6c 69 73 74 73 20 28 77 | 68 69 63 68 20 77 69 6c |lists (w|hich wil|
|00000c60| 6c 20 62 65 20 64 65 73 | 63 72 69 62 65 64 20 73 |l be des|cribed s|
|00000c70| 68 6f 72 74 6c 79 29 2e | 20 20 49 6e 20 61 64 64 |hortly).| In add|
|00000c80| 69 74 69 6f 6e 2c 20 61 | 20 66 75 6e 63 74 69 6f |ition, a| functio|
|00000c90| 6e 0d 0a 63 61 6e 20 72 | 65 74 75 72 6e 20 61 20 |n..can r|eturn a |
|00000ca0| 76 61 6c 75 65 20 74 6f | 20 69 74 73 20 63 61 6c |value to| its cal|
|00000cb0| 6c 65 72 2e 20 20 41 6e | 64 2c 20 6f 66 20 63 6f |ler. An|d, of co|
|00000cc0| 75 72 73 65 2c 20 6f 6e | 65 20 66 75 6e 63 74 69 |urse, on|e functi|
|00000cd0| 6f 6e 20 63 61 6e 20 63 | 61 6c 6c 0d 0a 61 6e 6f |on can c|all..ano|
|00000ce0| 74 68 65 72 20 28 6f 72 | 20 65 76 65 6e 20 69 74 |ther (or| even it|
|00000cf0| 73 65 6c 66 29 2e 20 20 | 49 6e 20 73 68 6f 72 74 |self). |In short|
|00000d00| 2c 20 6d 6f 73 74 20 70 | 72 6f 67 72 61 6d 73 20 |, most p|rograms |
|00000d10| 79 6f 75 20 63 6f 75 6c | 64 20 77 72 69 74 65 20 |you coul|d write |
|00000d20| 77 69 74 68 20 61 0d 0a | 6c 61 6e 67 75 61 67 65 |with a..|language|
|00000d30| 20 73 75 63 68 20 61 73 | 20 43 20 6f 72 20 50 61 | such as| C or Pa|
|00000d40| 73 63 61 6c 20 6f 72 20 | 42 41 53 49 43 20 63 6f |scal or |BASIC co|
|00000d50| 75 6c 64 20 62 65 20 77 | 72 69 74 74 65 6e 20 77 |uld be w|ritten w|
|00000d60| 69 74 68 20 54 41 44 53 | 20 66 75 6e 63 74 69 6f |ith TADS| functio|
|00000d70| 6e 73 2e 0d 0a 0d 0a 5c | 6d 61 6a 6f 72 73 65 63 |ns.....\|majorsec|
|00000d80| 74 69 6f 6e 20 4f 62 6a | 65 63 74 73 0d 0a 0d 0a |tion Obj|ects....|
|00000d90| 5e 7b 4f 62 6a 65 63 74 | 73 7d 20 61 72 65 20 74 |^{Object|s} are t|
|00000da0| 68 65 20 70 72 69 6d 61 | 72 79 20 65 6c 65 6d 65 |he prima|ry eleme|
|00000db0| 6e 74 73 20 6f 66 20 61 | 6e 79 20 54 41 44 53 20 |nts of a|ny TADS |
|00000dc0| 67 61 6d 65 2e 20 20 45 | 61 63 68 20 72 65 61 6c |game. E|ach real|
|00000dd0| 2d 77 6f 72 6c 64 20 65 | 6e 74 69 74 79 0d 0a 74 |-world e|ntity..t|
|00000de0| 68 61 74 20 61 20 74 65 | 78 74 20 61 64 76 65 6e |hat a te|xt adven|
|00000df0| 74 75 72 65 20 6d 6f 64 | 65 6c 73 20 69 73 20 64 |ture mod|els is d|
|00000e00| 65 73 63 72 69 62 65 64 | 20 62 79 20 61 20 54 41 |escribed| by a TA|
|00000e10| 44 53 20 6f 62 6a 65 63 | 74 2e 0d 0a 0d 0a 7b 5c |DS objec|t.....{\|
|00000e20| 6e 61 72 72 6f 77 65 72 | 5c 6d 65 64 73 6b 69 70 |narrower|\medskip|
|00000e30| 5c 6e 6f 69 6e 64 65 6e | 74 0d 0a 7b 5c 69 74 20 |\noinden|t..{\it |
|00000e40| 4e 6f 74 65 3a 7d 20 20 | 54 68 65 20 74 65 72 6d |Note:} |The term|
|00000e50| 20 60 60 6f 62 6a 65 63 | 74 22 20 68 61 73 20 61 | ``objec|t" has a|
|00000e60| 20 73 70 65 63 69 66 69 | 63 20 6d 65 61 6e 69 6e | specifi|c meanin|
|00000e70| 67 20 69 6e 20 74 68 65 | 20 63 6f 6e 74 65 78 74 |g in the| context|
|00000e80| 20 6f 66 0d 0a 54 41 44 | 53 20 70 72 6f 67 72 61 | of..TAD|S progra|
|00000e90| 6d 6d 69 6e 67 2c 20 61 | 6e 64 20 69 73 20 64 69 |mming, a|nd is di|
|00000ea0| 66 66 65 72 65 6e 74 20 | 66 72 6f 6d 20 69 74 73 |fferent |from its|
|00000eb0| 20 75 73 75 61 6c 20 75 | 73 65 20 69 6e 20 74 65 | usual u|se in te|
|00000ec0| 78 74 20 61 64 76 65 6e | 74 75 72 65 73 2e 0d 0a |xt adven|tures...|
|00000ed0| 57 68 69 6c 65 20 70 6c | 61 79 69 6e 67 20 61 20 |While pl|aying a |
|00000ee0| 67 61 6d 65 2c 20 79 6f | 75 20 74 68 69 6e 6b 20 |game, yo|u think |
|00000ef0| 6f 66 20 6f 62 6a 65 63 | 74 73 20 61 73 20 74 68 |of objec|ts as th|
|00000f00| 6f 73 65 20 74 68 69 6e | 67 73 20 79 6f 75 20 63 |ose thin|gs you c|
|00000f10| 61 6e 20 70 69 63 6b 0d | 0a 75 70 20 61 6e 64 20 |an pick.|.up and |
|00000f20| 6d 61 6e 69 70 75 6c 61 | 74 65 2e 20 20 49 6e 20 |manipula|te. In |
|00000f30| 61 20 54 41 44 53 20 70 | 72 6f 67 72 61 6d 2c 20 |a TADS p|rogram, |
|00000f40| 74 68 65 73 65 20 61 72 | 65 20 69 6e 64 65 65 64 |these ar|e indeed|
|00000f50| 20 72 65 70 72 65 73 65 | 6e 74 65 64 20 61 73 0d | represe|nted as.|
|00000f60| 0a 6f 62 6a 65 63 74 73 | 2c 20 62 75 74 20 73 6f |.objects|, but so|
|00000f70| 20 61 72 65 20 6d 61 6e | 79 20 6f 74 68 65 72 20 | are man|y other |
|00000f80| 74 68 69 6e 67 73 20 74 | 68 61 74 20 74 68 65 20 |things t|hat the |
|00000f90| 70 6c 61 79 65 72 20 64 | 6f 65 73 6e 27 74 20 64 |player d|oesn't d|
|00000fa0| 69 72 65 63 74 6c 79 0d | 0a 6d 61 6e 69 70 75 6c |irectly.|.manipul|
|00000fb0| 61 74 65 2c 20 73 75 63 | 68 20 61 73 20 72 6f 6f |ate, suc|h as roo|
|00000fc0| 6d 73 2c 20 61 63 74 6f | 72 73 2c 20 76 65 72 62 |ms, acto|rs, verb|
|00000fd0| 73 2c 20 61 6e 64 20 6d | 61 6e 79 20 6f 74 68 65 |s, and m|any othe|
|00000fe0| 72 20 74 68 69 6e 67 73 | 2e 0d 0a 5c 6d 65 64 73 |r things|...\meds|
|00000ff0| 6b 69 70 7d 0d 0a 0d 0a | 0d 0a 41 20 54 41 44 53 |kip}....|..A TADS|
|00001000| 20 6f 62 6a 65 63 74 20 | 69 73 20 73 6f 6d 65 74 | object |is somet|
|00001010| 68 69 6e 67 20 6c 69 6b | 65 20 61 20 5e 7b 43 7d |hing lik|e a ^{C}|
|00001020| 20 73 74 72 75 63 74 75 | 72 65 20 6f 72 20 5e 7b | structu|re or ^{|
|00001030| 50 61 73 63 61 6c 7d 0d | 0a 72 65 63 6f 72 64 2c |Pascal}.|.record,|
|00001040| 20 77 68 69 63 68 20 61 | 72 65 0d 0a 63 6f 6c 6c | which a|re..coll|
|00001050| 65 63 74 69 6f 6e 73 20 | 6f 66 20 72 65 6c 61 74 |ections |of relat|
|00001060| 65 64 20 64 61 74 61 20 | 28 73 75 63 68 20 61 73 |ed data |(such as|
|00001070| 20 6e 75 6d 62 65 72 73 | 20 61 6e 64 20 63 68 61 | numbers| and cha|
|00001080| 72 61 63 74 65 72 20 73 | 74 72 69 6e 67 73 29 20 |racter s|trings) |
|00001090| 67 61 74 68 65 72 65 64 | 0d 0a 74 6f 67 65 74 68 |gathered|..togeth|
|000010a0| 65 72 20 75 6e 64 65 72 | 20 61 20 73 69 6e 67 6c |er under| a singl|
|000010b0| 65 20 6e 61 6d 65 20 66 | 6f 72 20 63 6f 6e 76 65 |e name f|or conve|
|000010c0| 6e 69 65 6e 63 65 20 6f | 66 20 6d 61 6e 69 70 75 |nience o|f manipu|
|000010d0| 6c 61 74 69 6f 6e 2e 20 | 20 41 6e 20 6f 62 6a 65 |lation. | An obje|
|000010e0| 63 74 0d 0a 68 61 73 20 | 7b 5c 73 6c 20 70 72 6f |ct..has |{\sl pro|
|000010f0| 70 65 72 74 69 65 73 7d | 2c 20 77 68 69 63 68 20 |perties}|, which |
|00001100| 61 72 65 20 64 61 74 61 | 20 69 74 65 6d 73 20 61 |are data| items a|
|00001110| 73 73 6f 63 69 61 74 65 | 64 20 77 69 74 68 20 74 |ssociate|d with t|
|00001120| 68 65 20 6f 62 6a 65 63 | 74 2c 20 62 75 74 0d 0a |he objec|t, but..|
|00001130| 69 74 20 61 6c 73 6f 20 | 68 61 73 20 7b 5c 73 6c |it also |has {\sl|
|00001140| 20 6d 65 74 68 6f 64 73 | 7d 2c 20 77 68 69 63 68 | methods|}, which|
|00001150| 20 61 72 65 20 62 69 74 | 73 20 6f 66 20 63 6f 64 | are bit|s of cod|
|00001160| 65 20 74 69 65 64 20 74 | 6f 20 74 68 65 20 6f 62 |e tied t|o the ob|
|00001170| 6a 65 63 74 2e 20 20 4d | 65 74 68 6f 64 73 0d 0a |ject. M|ethods..|
|00001180| 61 72 65 20 76 65 72 79 | 20 6d 75 63 68 20 6c 69 |are very| much li|
|00001190| 6b 65 20 66 75 6e 63 74 | 69 6f 6e 73 3b 20 74 68 |ke funct|ions; th|
|000011a0| 65 20 64 69 66 66 65 72 | 65 6e 63 65 20 69 73 20 |e differ|ence is |
|000011b0| 74 68 61 74 20 61 20 6d | 65 74 68 6f 64 20 69 73 |that a m|ethod is|
|000011c0| 0d 0a 70 61 72 74 20 6f | 66 20 61 6e 20 6f 62 6a |..part o|f an obj|
|000011d0| 65 63 74 2c 20 77 68 65 | 72 65 61 73 20 61 20 66 |ect, whe|reas a f|
|000011e0| 75 6e 63 74 69 6f 6e 20 | 73 74 61 6e 64 73 20 61 |unction |stands a|
|000011f0| 6c 6f 6e 65 2c 20 61 6e | 64 20 69 73 20 6e 6f 74 |lone, an|d is not|
|00001200| 20 70 61 72 74 20 6f 66 | 20 61 6e 79 0d 0a 6f 62 | part of| any..ob|
|00001210| 6a 65 63 74 2e 0d 0a 0d | 0a 5c 6d 69 6e 6f 72 73 |ject....|.\minors|
|00001220| 65 63 74 69 6f 6e 20 50 | 72 6f 70 65 72 74 69 65 |ection P|ropertie|
|00001230| 73 0d 0a 0d 0a 49 6e 20 | 74 68 65 20 66 6f 6c 6c |s....In |the foll|
|00001240| 6f 77 69 6e 67 20 65 78 | 61 6d 70 6c 65 2c 20 6f |owing ex|ample, o|
|00001250| 6e 6c 79 20 5e 7b 70 72 | 6f 70 65 72 74 69 65 73 |nly ^{pr|operties|
|00001260| 7d 2c 20 6e 6f 74 20 6d | 65 74 68 6f 64 73 2c 20 |}, not m|ethods, |
|00001270| 61 72 65 20 64 65 66 69 | 6e 65 64 20 66 6f 72 0d |are defi|ned for.|
|00001280| 0a 61 6e 20 6f 62 6a 65 | 63 74 2e 0d 0a 0d 0a 7b |.an obje|ct.....{|
|00001290| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 20 5c 6f |\example|.. \o|
|000012a0| 62 6a 65 63 74 7b 72 6f | 62 6f 74 3a 20 6f 62 6a |bject{ro|bot: obj|
|000012b0| 65 63 74 7d 0d 0a 20 20 | 20 20 20 20 20 20 6e 61 |ect}.. | na|
|000012c0| 6d 65 20 3d 20 27 4c 6c | 6f 79 64 27 0d 0a 20 20 |me = 'Ll|oyd'.. |
|000012d0| 20 20 20 20 20 20 77 65 | 69 67 68 74 20 3d 20 33 | we|ight = 3|
|000012e0| 35 30 0d 0a 20 20 20 20 | 20 20 20 20 68 65 69 67 |50.. | heig|
|000012f0| 68 74 20 3d 20 37 32 0d | 0a 20 20 20 20 20 20 20 |ht = 72.|. |
|00001300| 20 73 70 65 65 64 20 3d | 20 35 0d 0a 20 20 20 20 | speed =| 5.. |
|00001310| 5c 65 6e 64 6f 62 6a 0d | 0a 7d 0d 0a 0d 0a 54 68 |\endobj.|.}....Th|
|00001320| 69 73 20 64 65 66 69 6e | 65 73 20 7b 5c 74 74 20 |is defin|es {\tt |
|00001330| 72 6f 62 6f 74 7d 20 61 | 73 20 61 6e 20 6f 62 6a |robot} a|s an obj|
|00001340| 65 63 74 2c 20 61 6e 64 | 20 73 70 65 63 69 66 69 |ect, and| specifi|
|00001350| 65 73 20 61 20 6c 69 73 | 74 20 6f 66 20 70 72 6f |es a lis|t of pro|
|00001360| 70 65 72 74 69 65 73 0d | 0a 61 6e 64 20 74 68 65 |perties.|.and the|
|00001370| 69 72 20 76 61 6c 75 65 | 73 2e 20 20 54 68 65 20 |ir value|s. The |
|00001380| 6c 69 6e 65 20 7b 5c 74 | 74 20 6e 61 6d 65 20 3d |line {\t|t name =|
|00001390| 20 27 4c 6c 6f 79 64 27 | 7d 20 73 61 79 73 20 74 | 'Lloyd'|} says t|
|000013a0| 68 61 74 20 74 68 65 20 | 70 72 6f 70 65 72 74 79 |hat the |property|
|000013b0| 0d 0a 7b 5c 74 74 20 6e | 61 6d 65 7d 0d 0a 68 61 |..{\tt n|ame}..ha|
|000013c0| 73 20 74 68 65 20 76 61 | 6c 75 65 20 7b 5c 74 74 |s the va|lue {\tt|
|000013d0| 20 27 4c 6c 6f 79 64 27 | 7d 2c 20 61 20 63 68 61 | 'Lloyd'|}, a cha|
|000013e0| 72 61 63 74 65 72 20 73 | 74 72 69 6e 67 2e 0d 0a |racter s|tring...|
|000013f0| 4c 69 6b 65 77 69 73 65 | 2c 20 7b 5c 74 74 20 77 |Likewise|, {\tt w|
|00001400| 65 69 67 68 74 20 3d 20 | 33 35 30 7d 20 73 61 79 |eight = |350} say|
|00001410| 73 20 74 68 61 74 20 74 | 68 65 0d 0a 70 72 6f 70 |s that t|he..prop|
|00001420| 65 72 74 79 20 7b 5c 74 | 74 20 77 65 69 67 68 74 |erty {\t|t weight|
|00001430| 7d 0d 0a 68 61 73 20 74 | 68 65 20 6e 75 6d 65 72 |}..has t|he numer|
|00001440| 69 63 20 76 61 6c 75 65 | 20 7b 5c 74 74 20 33 35 |ic value| {\tt 35|
|00001450| 30 7d 2c 20 61 6e 64 20 | 73 6f 20 66 6f 72 74 68 |0}, and |so forth|
|00001460| 2e 20 20 28 4e 6f 74 65 | 20 74 68 61 74 20 6f 6e |. (Note| that on|
|00001470| 6c 79 20 69 6e 74 65 67 | 72 61 6c 0d 0a 6e 75 6d |ly integ|ral..num|
|00001480| 62 65 72 73 20 61 72 65 | 20 73 75 70 70 6f 72 74 |bers are| support|
|00001490| 65 64 20 69 6e 20 54 41 | 44 53 3b 20 79 6f 75 20 |ed in TA|DS; you |
|000014a0| 63 61 6e 27 74 20 75 73 | 65 20 66 6c 6f 61 74 69 |can't us|e floati|
|000014b0| 6e 67 20 70 6f 69 6e 74 | 20 6e 75 6d 62 65 72 73 |ng point| numbers|
|000014c0| 20 73 75 63 68 0d 0a 61 | 73 20 24 33 2e 31 34 31 | such..a|s $3.141|
|000014d0| 35 39 32 36 24 2e 20 20 | 54 68 65 20 6d 61 78 69 |5926$. |The maxi|
|000014e0| 6d 75 6d 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |mum size| of the |
|000014f0| 6e 75 6d 62 65 72 73 20 | 74 68 61 74 20 54 41 44 |numbers |that TAD|
|00001500| 53 20 61 6c 6c 6f 77 73 | 0d 0a 69 73 20 61 62 6f |S allows|..is abo|
|00001510| 75 74 20 32 20 62 69 6c | 6c 69 6f 6e 2e 29 20 20 |ut 2 bil|lion.) |
|00001520| 54 68 65 20 73 65 6d 69 | 63 6f 6c 6f 6e 20 65 6e |The semi|colon en|
|00001530| 64 73 20 74 68 65 20 6f | 62 6a 65 63 74 20 64 65 |ds the o|bject de|
|00001540| 66 69 6e 69 74 69 6f 6e | 2e 0d 0a 0d 0a 54 6f 20 |finition|.....To |
|00001550| 67 65 74 20 61 74 20 61 | 6e 20 6f 62 6a 65 63 74 |get at a|n object|
|00001560| 27 73 20 70 72 6f 70 65 | 72 74 69 65 73 2c 20 79 |'s prope|rties, y|
|00001570| 6f 75 20 75 73 65 20 74 | 68 65 20 6e 61 6d 65 20 |ou use t|he name |
|00001580| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 2c 20 74 |of the o|bject, t|
|00001590| 68 65 6e 20 61 20 64 6f | 74 2c 0d 0a 74 68 65 6e |hen a do|t,..then|
|000015a0| 20 74 68 65 20 70 72 6f | 70 65 72 74 79 20 6e 61 | the pro|perty na|
|000015b0| 6d 65 2e 20 20 46 6f 72 | 20 65 78 61 6d 70 6c 65 |me. For| example|
|000015c0| 2c 20 7b 5c 74 74 20 72 | 6f 62 6f 74 2e 6e 61 6d |, {\tt r|obot.nam|
|000015d0| 65 7d 0d 0a 65 76 61 6c | 75 61 74 65 73 20 7b 5c |e}..eval|uates {\|
|000015e0| 74 74 20 6e 61 6d 65 7d | 20 70 72 6f 70 65 72 74 |tt name}| propert|
|000015f0| 79 20 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |y of the| object |
|00001600| 7b 5c 74 74 20 72 6f 62 | 6f 74 7d 2e 0d 0a 54 68 |{\tt rob|ot}...Th|
|00001610| 65 20 66 75 6e 63 74 69 | 6f 6e 20 62 65 6c 6f 77 |e functi|on below|
|00001620| 20 70 72 69 6e 74 73 20 | 6f 75 74 20 74 68 65 20 | prints |out the |
|00001630| 76 61 6c 75 65 20 6f 66 | 20 61 6e 20 6f 62 6a 65 |value of| an obje|
|00001640| 63 74 27 73 20 7b 5c 74 | 74 20 6e 61 6d 65 7d 20 |ct's {\t|t name} |
|00001650| 70 72 6f 70 65 72 74 79 | 2e 0d 0a 0d 0a 7b 5c 65 |property|.....{\e|
|00001660| 78 61 6d 70 6c 65 0d 0a | 20 20 20 20 73 68 6f 77 |xample..| show|
|00001670| 4e 61 6d 65 3a 20 66 75 | 6e 63 74 69 6f 6e 28 6f |Name: fu|nction(o|
|00001680| 62 6a 29 0d 0a 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |bj).. | \lb.. |
|00001690| 20 20 20 20 73 61 79 28 | 6f 62 6a 2e 6e 61 6d 65 | say(|obj.name|
|000016a0| 29 3b 0d 0a 20 20 20 20 | 5c 72 62 0d 0a 7d 0d 0a |);.. |\rb..}..|
|000016b0| 0d 0a 54 68 69 73 20 66 | 75 6e 63 74 69 6f 6e 27 |..This f|unction'|
|000016c0| 73 20 73 69 6e 67 6c 65 | 20 73 74 61 74 65 6d 65 |s single| stateme|
|000016d0| 6e 74 20 63 61 6c 6c 73 | 20 61 6e 6f 74 68 65 72 |nt calls| another|
|000016e0| 20 66 75 6e 63 74 69 6f | 6e 2c 20 7b 5c 74 74 20 | functio|n, {\tt |
|000016f0| 73 61 79 7d 2c 20 77 69 | 74 68 20 74 68 65 0d 0a |say}, wi|th the..|
|00001700| 61 72 67 75 6d 65 6e 74 | 20 7b 5c 74 74 20 6f 62 |argument| {\tt ob|
|00001710| 6a 2e 6e 61 6d 65 7d 2e | 20 20 7b 5c 74 74 20 73 |j.name}.| {\tt s|
|00001720| 61 79 7d 20 69 73 20 61 | 20 62 75 69 6c 74 2d 69 |ay} is a| built-i|
|00001730| 6e 20 66 75 6e 63 74 69 | 6f 6e 0d 0a 74 68 61 74 |n functi|on..that|
|00001740| 20 64 69 73 70 6c 61 79 | 73 20 61 20 6e 75 6d 62 | display|s a numb|
|00001750| 65 72 20 6f 72 20 61 20 | 73 74 72 69 6e 67 2e 20 |er or a |string. |
|00001760| 20 28 4e 6f 74 65 20 74 | 68 61 74 20 7b 5c 74 74 | (Note t|hat {\tt|
|00001770| 20 73 61 79 7d 0d 0a 77 | 69 6c 6c 20 64 65 74 65 | say}..w|ill dete|
|00001780| 72 6d 69 6e 65 20 77 68 | 65 6e 20 69 74 20 69 73 |rmine wh|en it is|
|00001790| 20 63 61 6c 6c 65 64 20 | 77 68 69 63 68 20 74 79 | called |which ty|
|000017a0| 70 65 20 6f 66 20 64 61 | 74 61 20 69 74 20 73 68 |pe of da|ta it sh|
|000017b0| 6f 75 6c 64 20 64 69 73 | 70 6c 61 79 2c 20 61 6e |ould dis|play, an|
|000017c0| 64 0d 0a 61 63 74 20 61 | 63 63 6f 72 64 69 6e 67 |d..act a|ccording|
|000017d0| 6c 79 2e 20 20 4d 61 6e | 79 20 62 75 69 6c 74 2d |ly. Man|y built-|
|000017e0| 69 6e 20 66 75 6e 63 74 | 69 6f 6e 73 20 77 69 6c |in funct|ions wil|
|000017f0| 6c 20 70 65 72 66 6f 72 | 6d 20 74 68 65 69 72 20 |l perfor|m their |
|00001800| 61 63 74 69 6f 6e 20 62 | 61 73 65 64 20 6f 6e 0d |action b|ased on.|
|00001810| 0a 74 68 65 20 74 79 70 | 65 20 6f 66 20 64 61 74 |.the typ|e of dat|
|00001820| 61 20 74 68 65 79 20 61 | 72 65 20 73 65 6e 74 2e |a they a|re sent.|
|00001830| 29 0d 0a 0d 0a 49 6e 20 | 7b 5c 74 74 20 72 6f 62 |)....In |{\tt rob|
|00001840| 6f 74 7d 2c 20 77 65 20 | 64 65 66 69 6e 65 64 20 |ot}, we |defined |
|00001850| 61 20 6e 75 6d 62 65 72 | 20 61 6e 64 20 61 20 73 |a number| and a s|
|00001860| 74 72 69 6e 67 2e 20 20 | 54 68 65 72 65 20 69 73 |tring. |There is|
|00001870| 20 61 6e 20 61 64 64 69 | 74 69 6f 6e 61 6c 0d 0a | an addi|tional..|
|00001880| 73 70 65 63 69 61 6c 20 | 74 79 70 65 20 6f 66 20 |special |type of |
|00001890| 73 74 72 69 6e 67 20 69 | 6e 20 54 41 44 53 2c 20 |string i|n TADS, |
|000018a0| 65 6e 63 6c 6f 73 65 64 | 20 69 6e 20 64 6f 75 62 |enclosed| in doub|
|000018b0| 6c 65 20 71 75 6f 74 65 | 73 2e 20 20 54 68 69 73 |le quote|s. This|
|000018c0| 20 74 79 70 65 20 6f 66 | 0d 0a 73 74 72 69 6e 67 | type of|..string|
|000018d0| 20 69 73 20 64 69 73 70 | 6c 61 79 65 64 20 61 75 | is disp|layed au|
|000018e0| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 77 68 65 6e |tomatica|lly when|
|000018f0| 65 76 65 72 20 69 74 20 | 69 73 20 65 76 61 6c 75 |ever it |is evalu|
|00001900| 61 74 65 64 2e 20 54 68 | 69 73 20 69 73 20 61 0d |ated. Th|is is a.|
|00001910| 0a 63 6f 6e 76 65 6e 69 | 65 6e 74 20 73 68 6f 72 |.conveni|ent shor|
|00001920| 74 68 61 6e 64 2c 20 62 | 65 63 61 75 73 65 20 69 |thand, b|ecause i|
|00001930| 74 20 72 65 6d 6f 76 65 | 73 20 74 68 65 20 6e 65 |t remove|s the ne|
|00001940| 65 64 20 74 6f 20 63 61 | 6c 6c 20 7b 5c 74 74 20 |ed to ca|ll {\tt |
|00001950| 73 61 79 7d 20 65 76 65 | 72 79 0d 0a 74 69 6d 65 |say} eve|ry..time|
|00001960| 20 79 6f 75 20 77 61 6e | 74 20 74 6f 20 70 72 69 | you wan|t to pri|
|00001970| 6e 74 20 61 20 73 74 72 | 69 6e 67 2e 20 20 53 69 |nt a str|ing. Si|
|00001980| 6e 63 65 20 74 65 78 74 | 20 61 64 76 65 6e 74 75 |nce text| adventu|
|00001990| 72 65 20 67 61 6d 65 73 | 20 64 69 73 70 6c 61 79 |re games| display|
|000019a0| 20 61 20 6c 6f 74 0d 0a | 6f 66 20 74 65 78 74 2c | a lot..|of text,|
|000019b0| 20 74 68 69 73 20 66 65 | 61 74 75 72 65 20 70 72 | this fe|ature pr|
|000019c0| 6f 76 65 73 20 74 6f 20 | 62 65 20 76 65 72 79 20 |oves to |be very |
|000019d0| 63 6f 6e 76 65 6e 69 65 | 6e 74 2e 0d 0a 0d 0a 7b |convenie|nt.....{|
|000019e0| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 20 5c 6f |\example|.. \o|
|000019f0| 62 6a 65 63 74 7b 6e 65 | 77 6f 62 6a 3a 20 6f 62 |bject{ne|wobj: ob|
|00001a00| 6a 65 63 74 7d 0d 0a 20 | 20 20 20 20 20 20 20 67 |ject}.. | g|
|00001a10| 72 65 65 74 69 6e 67 20 | 3d 20 22 48 65 6c 6c 6f |reeting |= "Hello|
|00001a20| 21 5c 63 68 61 72 60 5c | 5c 6e 22 0d 0a 20 20 20 |!\char`\|\n".. |
|00001a30| 20 5c 65 6e 64 6f 62 6a | 0d 0a 7d 0d 0a 0d 0a 54 | \endobj|..}....T|
|00001a40| 68 65 20 7b 5c 74 74 20 | 5c 63 68 61 72 60 5c 5c |he {\tt |\char`\\|
|00001a50| 6e 7d 20 61 74 20 74 68 | 65 20 65 6e 64 20 6f 66 |n} at th|e end of|
|00001a60| 20 74 68 65 20 73 74 72 | 69 6e 67 20 70 72 69 6e | the str|ing prin|
|00001a70| 74 73 20 61 20 5e 7b 6e | 65 77 6c 69 6e 65 7d 20 |ts a ^{n|ewline} |
|00001a80| 28 74 68 61 74 20 69 73 | 2c 0d 0a 69 74 20 6d 6f |(that is|,..it mo|
|00001a90| 76 65 73 20 74 68 65 20 | 63 75 72 73 6f 72 20 74 |ves the |cursor t|
|00001aa0| 6f 20 74 68 65 20 73 74 | 61 72 74 20 6f 66 20 61 |o the st|art of a|
|00001ab0| 20 6e 65 77 20 6c 69 6e | 65 29 2e 20 20 54 68 65 | new lin|e). The|
|00001ac0| 72 65 27 73 0d 0a 61 20 | 73 69 6d 69 6c 61 72 20 |re's..a |similar |
|00001ad0| 73 70 65 63 69 61 6c 20 | 63 6f 64 65 2c 20 7b 5c |special |code, {\|
|00001ae0| 74 74 20 5c 63 68 61 72 | 60 5c 5c 62 7d 2c 20 74 |tt \char|`\\b}, t|
|00001af0| 68 61 74 20 70 72 69 6e | 74 73 20 61 20 5e 7b 62 |hat prin|ts a ^{b|
|00001b00| 6c 61 6e 6b 20 6c 69 6e | 65 7d 2e 20 20 59 6f 75 |lank lin|e}. You|
|00001b10| 0d 0a 6d 69 67 68 74 20 | 77 6f 6e 64 65 72 20 77 |..might |wonder w|
|00001b20| 68 79 20 7b 5c 74 74 20 | 5c 63 68 61 72 60 5c 5c |hy {\tt |\char`\\|
|00001b30| 62 7d 20 69 73 20 6e 65 | 65 64 65 64 2c 20 77 68 |b} is ne|eded, wh|
|00001b40| 65 6e 20 79 6f 75 20 63 | 6f 75 6c 64 20 6a 75 73 |en you c|ould jus|
|00001b50| 74 20 75 73 65 20 74 77 | 6f 0d 0a 7b 5c 74 74 20 |t use tw|o..{\tt |
|00001b60| 5c 63 68 61 72 60 5c 5c | 6e 7d 27 73 3b 20 74 68 |\char`\\|n}'s; th|
|00001b70| 65 20 72 65 61 73 6f 6e | 20 69 73 20 74 68 61 74 |e reason| is that|
|00001b80| 20 54 41 44 53 20 77 69 | 6c 6c 20 69 67 6e 6f 72 | TADS wi|ll ignor|
|00001b90| 65 20 72 65 64 75 6e 64 | 61 6e 74 20 6e 65 77 6c |e redund|ant newl|
|00001ba0| 69 6e 65 73 2e 0d 0a 4d | 6f 73 74 20 6f 66 20 74 |ines...M|ost of t|
|00001bb0| 68 65 20 74 69 6d 65 2c | 20 74 68 69 73 20 6d 61 |he time,| this ma|
|00001bc0| 6b 65 73 20 6f 75 74 70 | 75 74 20 66 6f 72 6d 61 |kes outp|ut forma|
|00001bd0| 74 74 69 6e 67 20 65 61 | 73 69 65 72 2c 20 62 65 |tting ea|sier, be|
|00001be0| 63 61 75 73 65 20 79 6f | 75 20 64 6f 6e 27 74 0d |cause yo|u don't.|
|00001bf0| 0a 68 61 76 65 20 74 6f | 20 77 6f 72 72 79 20 61 |.have to| worry a|
|00001c00| 62 6f 75 74 20 68 61 76 | 69 6e 67 20 74 6f 6f 20 |bout hav|ing too |
|00001c10| 6d 61 6e 79 20 6e 65 77 | 6c 69 6e 65 73 2e 20 4f |many new|lines. O|
|00001c20| 6e 63 65 20 69 6e 20 61 | 20 77 68 69 6c 65 2c 20 |nce in a| while, |
|00001c30| 74 68 6f 75 67 68 2c 20 | 79 6f 75 0d 0a 72 65 61 |though, |you..rea|
|00001c40| 6c 6c 79 20 77 61 6e 74 | 20 61 20 62 6c 61 6e 6b |lly want| a blank|
|00001c50| 20 6c 69 6e 65 3b 20 79 | 6f 75 20 63 61 6e 20 75 | line; y|ou can u|
|00001c60| 73 65 20 7b 5c 74 74 20 | 5c 63 68 61 72 60 5c 5c |se {\tt |\char`\\|
|00001c70| 62 7d 20 61 74 20 74 68 | 65 73 65 20 74 69 6d 65 |b} at th|ese time|
|00001c80| 73 2e 0d 0a 0d 0a 50 72 | 6f 70 65 72 74 79 20 7b |s.....Pr|operty {|
|00001c90| 5c 74 74 20 67 72 65 65 | 74 69 6e 67 7d 2c 20 77 |\tt gree|ting}, w|
|00001ca0| 68 65 6e 0d 0a 65 76 61 | 6c 75 61 74 65 64 2c 20 |hen..eva|luated, |
|00001cb0| 77 69 6c 6c 20 73 69 6d | 70 6c 79 20 70 72 69 6e |will sim|ply prin|
|00001cc0| 74 20 74 68 65 20 73 74 | 72 69 6e 67 20 7b 5c 74 |t the st|ring {\t|
|00001cd0| 74 20 48 65 6c 6c 6f 21 | 7d 20 61 6e 64 20 61 20 |t Hello!|} and a |
|00001ce0| 6e 65 77 6c 69 6e 65 2e | 20 20 53 6f 2c 20 72 61 |newline.| So, ra|
|00001cf0| 74 68 65 72 0d 0a 74 68 | 61 6e 20 63 61 6c 6c 69 |ther..th|an calli|
|00001d00| 6e 67 20 74 68 65 20 62 | 75 69 6c 74 2d 69 6e 20 |ng the b|uilt-in |
|00001d10| 7b 5c 74 74 20 73 61 79 | 7d 20 72 6f 75 74 69 6e |{\tt say|} routin|
|00001d20| 65 20 74 6f 20 64 69 73 | 70 6c 61 79 20 74 68 65 |e to dis|play the|
|00001d30| 20 76 61 6c 75 65 20 6f | 66 0d 0a 7b 5c 74 74 20 | value o|f..{\tt |
|00001d40| 6e 65 77 6f 62 6a 2e 67 | 72 65 65 74 69 6e 67 7d |newobj.g|reeting}|
|00001d50| 2c 20 79 6f 75 20 77 6f | 75 6c 64 20 73 69 6d 70 |, you wo|uld simp|
|00001d60| 6c 79 20 65 76 61 6c 75 | 61 74 65 20 74 68 65 20 |ly evalu|ate the |
|00001d70| 70 72 6f 70 65 72 74 79 | 20 69 74 73 65 6c 66 3a |property| itself:|
|00001d80| 0d 0a 0d 0a 7b 5c 65 78 | 61 6d 70 6c 65 0d 0a 20 |....{\ex|ample.. |
|00001d90| 20 20 20 70 72 69 6e 74 | 47 72 65 65 74 69 6e 67 | print|Greeting|
|00001da0| 3a 20 66 75 6e 63 74 69 | 6f 6e 28 6f 62 6a 29 0d |: functi|on(obj).|
|00001db0| 0a 20 20 20 20 5c 6c 62 | 0d 0a 20 20 20 20 20 20 |. \lb|.. |
|00001dc0| 6f 62 6a 2e 67 72 65 65 | 74 69 6e 67 3b 0d 0a 20 |obj.gree|ting;.. |
|00001dd0| 20 20 20 5c 72 62 0d 0a | 7d 0d 0a 0d 0a 50 72 6f | \rb..|}....Pro|
|00001de0| 70 65 72 74 69 65 73 20 | 63 61 6e 20 61 6c 73 6f |perties |can also|
|00001df0| 20 68 61 76 65 20 7b 5c | 73 6c 20 5e 7b 6c 69 73 | have {\|sl ^{lis|
|00001e00| 74 7d 7d 20 76 61 6c 75 | 65 73 2e 0d 0a 41 20 7b |t}} valu|es...A {|
|00001e10| 5c 73 6c 20 6c 69 73 74 | 7d 20 69 73 20 61 20 73 |\sl list|} is a s|
|00001e20| 65 74 20 6f 66 20 76 61 | 6c 75 65 73 20 65 6e 63 |et of va|lues enc|
|00001e30| 6c 6f 73 65 64 20 69 6e | 20 5e 7b 73 71 75 61 72 |losed in| ^{squar|
|00001e40| 65 20 62 72 61 63 6b 65 | 74 73 7d 2c 20 73 75 63 |e bracke|ts}, suc|
|00001e50| 68 20 61 73 20 74 68 69 | 73 3a 0d 0a 0d 0a 7b 5c |h as thi|s:....{\|
|00001e60| 65 78 61 6d 70 6c 65 0d | 0a 20 20 20 20 5c 6f 62 |example.|. \ob|
|00001e70| 6a 65 63 74 7b 6c 69 73 | 74 6f 62 6a 3a 20 6f 62 |ject{lis|tobj: ob|
|00001e80| 6a 65 63 74 7d 0d 0a 20 | 20 20 20 20 20 20 20 6d |ject}.. | m|
|00001e90| 79 6c 69 73 74 20 3d 20 | 5b 31 20 32 20 33 5d 0d |ylist = |[1 2 3].|
|00001ea0| 0a 20 20 20 20 5c 65 6e | 64 6f 62 6a 0d 0a 7d 0d |. \en|dobj..}.|
|00001eb0| 0a 0d 0a 45 6c 65 6d 65 | 6e 74 73 20 6f 66 20 61 |...Eleme|nts of a|
|00001ec0| 20 6c 69 73 74 20 6e 65 | 65 64 20 6e 6f 74 20 62 | list ne|ed not b|
|00001ed0| 65 20 6f 66 20 74 68 65 | 20 73 61 6d 65 20 5e 7b |e of the| same ^{|
|00001ee0| 64 61 74 61 74 79 70 65 | 7d 2c 20 62 75 74 20 74 |datatype|}, but t|
|00001ef0| 68 65 79 20 67 65 6e 65 | 72 61 6c 6c 79 20 61 72 |hey gene|rally ar|
|00001f00| 65 2e 0d 0a 4c 69 73 74 | 73 20 61 72 65 20 63 6f |e...List|s are co|
|00001f10| 6e 76 65 6e 69 65 6e 74 | 20 77 68 65 6e 20 79 6f |nvenient| when yo|
|00001f20| 75 20 6e 65 65 64 20 74 | 6f 20 6b 65 65 70 20 72 |u need t|o keep r|
|00001f30| 65 6c 61 74 65 64 20 69 | 74 65 6d 73 20 74 6f 67 |elated i|tems tog|
|00001f40| 65 74 68 65 72 20 69 6e | 20 6f 6e 65 0d 0a 70 6c |ether in| one..pl|
|00001f50| 61 63 65 2c 20 65 73 70 | 65 63 69 61 6c 6c 79 20 |ace, esp|ecially |
|00001f60| 77 68 65 6e 20 74 68 65 | 20 67 72 6f 75 70 20 6f |when the| group o|
|00001f70| 66 20 69 74 65 6d 73 20 | 63 68 61 6e 67 65 73 20 |f items |changes |
|00001f80| 66 72 6f 6d 20 74 69 6d | 65 20 74 6f 20 74 69 6d |from tim|e to tim|
|00001f90| 65 2e 0d 0a 0d 0a 53 65 | 76 65 72 61 6c 20 6f 70 |e.....Se|veral op|
|00001fa0| 65 72 61 74 6f 72 73 20 | 61 6e 64 20 62 75 69 6c |erators |and buil|
|00001fb0| 74 2d 69 6e 20 66 75 6e | 63 74 69 6f 6e 73 20 70 |t-in fun|ctions p|
|00001fc0| 65 72 66 6f 72 6d 20 6c | 69 73 74 20 6f 70 65 72 |erform l|ist oper|
|00001fd0| 61 74 69 6f 6e 73 2e 0d | 0a 4f 70 65 72 61 74 6f |ations..|.Operato|
|00001fe0| 72 73 20 61 72 65 20 70 | 72 6f 76 69 64 65 64 20 |rs are p|rovided |
|00001ff0| 74 6f 20 61 64 64 20 69 | 74 65 6d 73 20 74 6f 20 |to add i|tems to |
|00002000| 61 6e 64 20 72 65 6d 6f | 76 65 20 69 74 65 6d 73 |and remo|ve items|
|00002010| 20 66 72 6f 6d 20 61 20 | 6c 69 73 74 2c 20 61 6e | from a |list, an|
|00002020| 64 0d 0a 74 6f 20 72 65 | 66 65 72 65 6e 63 65 20 |d..to re|ference |
|00002030| 61 6e 20 69 6e 64 69 76 | 69 64 75 61 6c 20 69 74 |an indiv|idual it|
|00002040| 65 6d 20 69 6e 20 61 20 | 6c 69 73 74 2e 20 20 42 |em in a |list. B|
|00002050| 75 69 6c 74 2d 69 6e 20 | 66 75 6e 63 74 69 6f 6e |uilt-in |function|
|00002060| 73 20 61 72 65 20 70 72 | 6f 76 69 64 65 64 0d 0a |s are pr|ovided..|
|00002070| 74 6f 20 73 63 61 6e 20 | 74 68 72 6f 75 67 68 20 |to scan |through |
|00002080| 61 20 6c 69 73 74 2c 20 | 61 6e 64 20 74 6f 20 66 |a list, |and to f|
|00002090| 69 6e 64 20 61 6e 20 69 | 74 65 6d 20 77 69 74 68 |ind an i|tem with|
|000020a0| 69 6e 20 61 20 6c 69 73 | 74 2e 0d 0a 0d 0a 41 73 |in a lis|t.....As|
|000020b0| 20 61 6e 20 65 78 61 6d | 70 6c 65 20 6f 66 20 68 | an exam|ple of h|
|000020c0| 6f 77 20 74 6f 20 73 63 | 61 6e 20 74 68 72 6f 75 |ow to sc|an throu|
|000020d0| 67 68 20 61 20 6c 69 73 | 74 2c 20 74 68 65 20 66 |gh a lis|t, the f|
|000020e0| 75 6e 63 74 69 6f 6e 20 | 62 65 6c 6f 77 0d 0a 64 |unction |below..d|
|000020f0| 69 73 70 6c 61 79 73 20 | 61 6c 6c 20 74 68 65 20 |isplays |all the |
|00002100| 65 6c 65 6d 65 6e 74 73 | 20 6f 66 20 74 68 65 20 |elements| of the |
|00002110| 6c 69 73 74 20 63 6f 6e | 74 61 69 6e 65 64 20 69 |list con|tained i|
|00002120| 6e 20 7b 5c 74 74 20 6c | 69 73 74 6f 62 6a 2e 6d |n {\tt l|istobj.m|
|00002130| 79 6c 69 73 74 7d 2e 0d | 0a 54 68 69 73 20 65 78 |ylist}..|.This ex|
|00002140| 61 6d 70 6c 65 20 75 73 | 65 73 0d 0a 74 68 65 20 |ample us|es..the |
|00002150| 5e 7b 6c 69 73 74 20 69 | 6e 64 65 78 69 6e 67 7d |^{list i|ndexing}|
|00002160| 20 6f 70 65 72 61 74 6f | 72 2c 20 7b 5c 74 74 20 | operato|r, {\tt |
|00002170| 5b 7b 5c 69 74 20 69 6e | 64 65 78 7d 5d 7d 2c 20 |[{\it in|dex}]}, |
|00002180| 74 6f 20 6f 62 74 61 69 | 6e 20 74 68 65 20 69 6e |to obtai|n the in|
|00002190| 64 69 76 69 64 75 61 6c | 0d 0a 65 6e 74 72 69 65 |dividual|..entrie|
|000021a0| 73 20 69 6e 20 74 68 65 | 20 6c 69 73 74 2e 20 20 |s in the| list. |
|000021b0| 49 74 20 61 6c 73 6f 20 | 75 73 65 73 20 74 68 65 |It also |uses the|
|000021c0| 20 62 75 69 6c 74 2d 69 | 6e 20 66 75 6e 63 74 69 | built-i|n functi|
|000021d0| 6f 6e 20 7b 5c 74 74 20 | 5e 7b 6c 65 6e 67 74 68 |on {\tt |^{length|
|000021e0| 7d 28 29 7d 0d 0a 74 6f | 20 64 65 74 65 72 6d 69 |}()}..to| determi|
|000021f0| 6e 65 20 68 6f 77 20 6d | 61 6e 79 20 65 6c 65 6d |ne how m|any elem|
|00002200| 65 6e 74 73 20 61 72 65 | 20 69 6e 20 74 68 65 20 |ents are| in the |
|00002210| 6c 69 73 74 2e 0d 0a 0d | 0a 7b 5c 65 78 61 6d 70 |list....|.{\examp|
|00002220| 6c 65 0d 0a 20 20 20 20 | 73 68 6f 77 4c 69 73 74 |le.. |showList|
|00002230| 3a 20 66 75 6e 63 74 69 | 6f 6e 0d 0a 20 20 20 20 |: functi|on.. |
|00002240| 5c 6c 62 0d 0a 20 20 20 | 20 20 20 20 20 6c 6f 63 |\lb.. | loc|
|00002250| 61 6c 20 69 6e 64 2c 20 | 6c 65 6e 3b 0d 0a 09 0d |al ind, |len;....|
|00002260| 0a 09 6c 65 6e 20 3a 3d | 20 6c 65 6e 67 74 68 28 |..len :=| length(|
|00002270| 6c 69 73 74 6f 62 6a 2e | 6d 79 6c 69 73 74 29 3b |listobj.|mylist);|
|00002280| 20 20 5c 68 66 69 6c 6c | 20 2f 2f 20 46 69 6e 64 | \hfill| // Find|
|00002290| 20 74 68 65 20 6c 69 73 | 74 27 73 20 6c 65 6e 67 | the lis|t's leng|
|000022a0| 74 68 0d 0a 09 69 6e 64 | 20 3a 3d 20 31 3b 20 20 |th...ind| := 1; |
|000022b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000022c0| 20 20 5c 68 66 69 6c 6c | 20 2f 2f 20 73 74 61 72 | \hfill| // star|
|000022d0| 74 20 61 74 20 66 69 72 | 73 74 20 65 6c 65 6d 65 |t at fir|st eleme|
|000022e0| 6e 74 0d 0a 09 77 68 69 | 6c 65 20 28 69 6e 64 20 |nt...whi|le (ind |
|000022f0| 3c 3d 20 6c 65 6e 29 20 | 20 20 20 20 20 20 20 20 |<= len) | |
|00002300| 20 5c 68 66 69 6c 6c 20 | 2f 2f 20 6c 6f 6f 70 20 | \hfill |// loop |
|00002310| 6f 76 65 72 20 65 61 63 | 68 20 65 6c 65 6d 65 6e |over eac|h elemen|
|00002320| 74 0d 0a 09 5c 6c 62 0d | 0a 09 20 20 20 20 73 61 |t...\lb.|.. sa|
|00002330| 79 28 6c 69 73 74 6f 62 | 6a 2e 6d 79 6c 69 73 74 |y(listob|j.mylist|
|00002340| 5b 69 6e 64 5d 29 3b 20 | 20 20 5c 68 66 69 6c 6c |[ind]); | \hfill|
|00002350| 20 2f 2f 20 64 69 73 70 | 6c 61 79 20 74 68 69 73 | // disp|lay this|
|00002360| 20 65 6e 74 72 79 0d 0a | 09 20 20 20 20 22 5c 63 | entry..|. "\c|
|00002370| 68 61 72 60 5c 5c 6e 22 | 3b 20 20 20 20 20 20 20 |har`\\n"|; |
|00002380| 20 20 20 20 20 20 5c 68 | 66 69 6c 6c 20 2f 2f 20 | \h|fill // |
|00002390| 44 69 73 70 6c 61 79 20 | 61 20 6e 65 77 6c 69 6e |Display |a newlin|
|000023a0| 65 0d 0a 09 20 20 20 20 | 69 6e 64 20 3a 3d 20 69 |e... |ind := i|
|000023b0| 6e 64 20 2b 20 31 3b 20 | 20 20 20 20 20 20 20 20 |nd + 1; | |
|000023c0| 20 5c 68 66 69 6c 6c 20 | 2f 2f 20 6d 6f 76 65 20 | \hfill |// move |
|000023d0| 6f 6e 20 74 6f 20 74 68 | 65 20 6e 65 78 74 20 65 |on to th|e next e|
|000023e0| 6c 65 6d 65 6e 74 0d 0a | 09 5c 72 62 0d 0a 20 20 |lement..|.\rb.. |
|000023f0| 20 20 5c 72 62 0d 0a 7d | 0d 0a 0d 0a 49 66 20 79 | \rb..}|....If y|
|00002400| 6f 75 27 72 65 20 66 61 | 6d 69 6c 69 61 72 20 77 |ou're fa|miliar w|
|00002410| 69 74 68 20 43 2c 20 79 | 6f 75 20 77 6f 75 6c 64 |ith C, y|ou would|
|00002420| 20 70 72 6f 62 61 62 6c | 79 20 77 61 6e 74 20 74 | probabl|y want t|
|00002430| 6f 20 77 72 69 74 65 20 | 74 68 65 20 6c 6f 6f 70 |o write |the loop|
|00002440| 0d 0a 69 6e 20 74 68 65 | 20 65 78 61 6d 70 6c 65 |..in the| example|
|00002450| 20 61 62 6f 76 65 20 75 | 73 69 6e 67 20 74 68 65 | above u|sing the|
|00002460| 20 7b 5c 74 74 20 66 6f | 72 7d 20 73 74 61 74 65 | {\tt fo|r} state|
|00002470| 6d 65 6e 74 2c 20 77 68 | 69 63 68 20 77 6f 75 6c |ment, wh|ich woul|
|00002480| 64 20 61 6c 6c 6f 77 0d | 0a 79 6f 75 20 74 6f 20 |d allow.|.you to |
|00002490| 70 75 74 20 74 68 65 20 | 6c 6f 6f 70 20 69 6e 69 |put the |loop ini|
|000024a0| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 2c 20 63 6f 6e |tializat|ion, con|
|000024b0| 64 69 74 69 6f 6e 20 74 | 65 73 74 2c 20 61 6e 64 |dition t|est, and|
|000024c0| 20 6c 6f 6f 70 20 76 61 | 72 69 61 62 6c 65 0d 0a | loop va|riable..|
|000024d0| 69 6e 63 72 65 6d 65 6e | 74 20 74 6f 67 65 74 68 |incremen|t togeth|
|000024e0| 65 72 20 69 6e 20 61 20 | 73 69 6e 67 6c 65 20 73 |er in a |single s|
|000024f0| 74 61 74 65 6d 65 6e 74 | 2e 20 20 59 6f 75 20 63 |tatement|. You c|
|00002500| 61 6e 20 75 73 65 20 74 | 68 65 20 7b 5c 74 74 20 |an use t|he {\tt |
|00002510| 66 6f 72 7d 0d 0a 73 74 | 61 74 65 6d 65 6e 74 20 |for}..st|atement |
|00002520| 69 6e 20 54 41 44 53 20 | 74 68 65 20 73 61 6d 65 |in TADS |the same|
|00002530| 20 77 61 79 20 79 6f 75 | 20 75 73 65 20 69 74 20 | way you| use it |
|00002540| 69 6e 20 43 2c 20 73 6f | 20 79 6f 75 20 63 61 6e |in C, so| you can|
|00002550| 20 72 65 77 72 69 74 65 | 0d 0a 74 68 65 20 7b 5c | rewrite|..the {\|
|00002560| 74 74 20 73 68 6f 77 4c | 69 73 74 7d 20 66 75 6e |tt showL|ist} fun|
|00002570| 63 74 69 6f 6e 20 77 69 | 74 68 20 61 20 7b 5c 74 |ction wi|th a {\t|
|00002580| 74 20 66 6f 72 7d 20 6c | 6f 6f 70 20 61 73 20 73 |t for} l|oop as s|
|00002590| 68 6f 77 6e 20 62 65 6c | 6f 77 2e 0d 0a 0d 0a 7b |hown bel|ow.....{|
|000025a0| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 20 73 68 |\example|.. sh|
|000025b0| 6f 77 4c 69 73 74 3a 20 | 66 75 6e 63 74 69 6f 6e |owList: |function|
|000025c0| 0d 0a 20 20 20 20 5c 6c | 62 0d 0a 20 20 20 20 20 |.. \l|b.. |
|000025d0| 20 20 20 6c 6f 63 61 6c | 20 69 6e 64 3b 0d 0a 20 | local| ind;.. |
|000025e0| 20 20 20 20 20 20 20 6c | 6f 63 61 6c 20 6c 65 6e | l|ocal len|
|000025f0| 20 3a 3d 20 6c 65 6e 67 | 74 68 28 6c 69 73 74 6f | := leng|th(listo|
|00002600| 62 6a 2e 6d 79 6c 69 73 | 74 29 3b 20 20 5c 68 66 |bj.mylis|t); \hf|
|00002610| 69 6c 6c 20 2f 2f 20 73 | 61 76 65 20 6c 69 73 74 |ill // s|ave list|
|00002620| 27 73 20 6c 65 6e 67 74 | 68 0d 0a 09 0d 0a 09 66 |'s lengt|h......f|
|00002630| 6f 72 20 28 69 6e 64 20 | 3a 3d 20 31 20 3b 20 69 |or (ind |:= 1 ; i|
|00002640| 6e 64 20 3c 3d 20 6c 65 | 6e 20 3b 20 69 6e 64 2b |nd <= le|n ; ind+|
|00002650| 2b 29 0d 0a 09 5c 6c 62 | 0d 0a 09 20 20 20 20 73 |+)...\lb|... s|
|00002660| 61 79 28 6c 69 73 74 6f | 62 6a 2e 6d 79 6c 69 73 |ay(listo|bj.mylis|
|00002670| 74 5b 69 6e 64 5d 29 3b | 20 20 20 5c 68 66 69 6c |t[ind]);| \hfil|
|00002680| 6c 20 2f 2f 20 64 69 73 | 70 6c 61 79 20 74 68 69 |l // dis|play thi|
|00002690| 73 20 65 6e 74 72 79 0d | 0a 09 20 20 20 20 22 5c |s entry.|.. "\|
|000026a0| 63 68 61 72 60 5c 5c 6e | 22 3b 20 20 20 20 20 20 |char`\\n|"; |
|000026b0| 20 20 20 20 20 20 20 5c | 68 66 69 6c 6c 20 2f 2f | \|hfill //|
|000026c0| 20 44 69 73 70 6c 61 79 | 20 61 20 6e 65 77 6c 69 | Display| a newli|
|000026d0| 6e 65 0d 0a 09 5c 72 62 | 0d 0a 20 20 20 20 5c 72 |ne...\rb|.. \r|
|000026e0| 62 0d 0a 7d 0d 0a 0d 0a | 41 6e 20 61 6c 74 65 72 |b..}....|An alter|
|000026f0| 6e 61 74 69 76 65 20 77 | 61 79 20 6f 66 20 73 63 |native w|ay of sc|
|00002700| 61 6e 6e 69 6e 67 20 69 | 74 65 6d 73 20 69 6e 20 |anning i|tems in |
|00002710| 61 20 6c 69 73 74 20 69 | 73 20 74 6f 20 75 73 65 |a list i|s to use|
|00002720| 20 74 68 65 20 62 75 69 | 6c 74 2d 69 6e 0d 0a 66 | the bui|lt-in..f|
|00002730| 75 6e 63 74 69 6f 6e 73 | 20 7b 5c 74 74 20 5e 7b |unctions| {\tt ^{|
|00002740| 63 61 72 7d 28 29 7d 20 | 61 6e 64 20 7b 5c 74 74 |car}()} |and {\tt|
|00002750| 20 5e 7b 63 64 72 7d 28 | 29 7d 2e 0d 0a 54 68 65 | ^{cdr}(|)}...The|
|00002760| 20 65 78 61 6d 70 6c 65 | 20 62 65 6c 6f 77 20 64 | example| below d|
|00002770| 65 6d 6f 6e 73 74 72 61 | 74 65 73 20 74 68 65 73 |emonstra|tes thes|
|00002780| 65 20 66 75 6e 63 74 69 | 6f 6e 73 2e 0d 0a 0d 0a |e functi|ons.....|
|00002790| 7b 5c 65 78 61 6d 70 6c | 65 0d 0a 20 20 20 20 73 |{\exampl|e.. s|
|000027a0| 68 6f 77 4c 69 73 74 32 | 3a 20 66 75 6e 63 74 69 |howList2|: functi|
|000027b0| 6f 6e 0d 0a 20 20 20 20 | 5c 6c 62 0d 0a 20 20 20 |on.. |\lb.. |
|000027c0| 20 20 20 20 20 6c 6f 63 | 61 6c 20 63 75 72 3b 20 | loc|al cur; |
|000027d0| 20 20 20 20 20 20 20 5c | 68 66 69 6c 6c 20 20 2f | \|hfill /|
|000027e0| 2f 20 41 20 76 61 72 69 | 61 62 6c 65 20 66 6f 72 |/ A vari|able for|
|000027f0| 20 74 68 65 20 72 65 6d | 61 69 6e 64 65 72 20 6f | the rem|ainder o|
|00002800| 66 20 74 68 65 20 6c 69 | 73 74 0d 0a 09 63 75 72 |f the li|st...cur|
|00002810| 20 3a 3d 20 6c 69 73 74 | 6f 62 6a 2e 6d 79 6c 69 | := list|obj.myli|
|00002820| 73 74 3b 20 20 5c 68 66 | 69 6c 6c 20 2f 2f 20 53 |st; \hf|ill // S|
|00002830| 74 61 72 74 20 77 69 74 | 68 20 74 68 65 20 77 68 |tart wit|h the wh|
|00002840| 6f 6c 65 20 6c 69 73 74 | 0d 0a 09 77 68 69 6c 65 |ole list|...while|
|00002850| 20 28 63 61 72 28 63 75 | 72 29 29 5c 68 66 69 6c | (car(cu|r))\hfil|
|00002860| 6c 20 20 2f 2f 20 63 61 | 72 28 6c 69 73 74 29 20 |l // ca|r(list) |
|00002870| 69 73 20 74 68 65 20 66 | 69 72 73 74 20 65 6c 65 |is the f|irst ele|
|00002880| 6d 65 6e 74 20 6f 66 20 | 61 20 6c 69 73 74 0d 0a |ment of |a list..|
|00002890| 09 5c 6c 62 0d 0a 09 20 | 20 20 20 73 61 79 28 63 |.\lb... | say(c|
|000028a0| 61 72 28 63 75 72 29 29 | 3b 5c 68 66 69 6c 6c 20 |ar(cur))|;\hfill |
|000028b0| 2f 2f 20 44 69 73 70 6c | 61 79 20 74 68 65 20 66 |// Displ|ay the f|
|000028c0| 69 72 73 74 20 65 6c 65 | 6d 65 6e 74 20 6f 66 20 |irst ele|ment of |
|000028d0| 72 65 73 74 20 6f 66 20 | 6c 69 73 74 0d 0a 09 20 |rest of |list... |
|000028e0| 20 20 20 22 5c 63 68 61 | 72 60 5c 5c 6e 22 3b 20 | "\cha|r`\\n"; |
|000028f0| 20 20 20 20 20 20 20 20 | 5c 68 66 69 6c 6c 20 20 | |\hfill |
|00002900| 2f 2f 20 44 69 73 70 6c | 61 79 20 61 20 6e 65 77 |// Displ|ay a new|
|00002910| 6c 69 6e 65 0d 0a 09 20 | 20 20 20 63 75 72 20 3a |line... | cur :|
|00002920| 3d 20 63 64 72 28 63 75 | 72 29 3b 20 5c 68 66 69 |= cdr(cu|r); \hfi|
|00002930| 6c 6c 20 20 20 2f 2f 20 | 63 64 72 28 6c 69 73 74 |ll // |cdr(list|
|00002940| 29 20 69 73 20 74 68 65 | 20 72 65 73 74 20 6f 66 |) is the| rest of|
|00002950| 20 74 68 65 20 6c 69 73 | 74 3b 0d 0a 09 20 20 20 | the lis|t;... |
|00002960| 20 09 20 20 20 20 20 20 | 5c 68 66 69 6c 6c 20 2f | . |\hfill /|
|00002970| 2f 20 74 68 61 74 20 69 | 73 2c 20 65 76 65 72 79 |/ that i|s, every|
|00002980| 74 68 69 6e 67 20 62 75 | 74 20 74 68 65 20 63 61 |thing bu|t the ca|
|00002990| 72 20 6f 66 20 74 68 65 | 20 6c 69 73 74 0d 0a 09 |r of the| list...|
|000029a0| 5c 72 62 0d 0a 20 20 20 | 20 5c 72 62 0d 0a 7d 0d |\rb.. | \rb..}.|
|000029b0| 0a 0d 0a 54 68 69 73 20 | 66 75 6e 63 74 69 6f 6e |...This |function|
|000029c0| 20 6c 6f 6f 70 73 20 74 | 68 72 6f 75 67 68 20 74 | loops t|hrough t|
|000029d0| 68 65 20 6c 69 73 74 20 | 65 6c 65 6d 65 6e 74 20 |he list |element |
|000029e0| 62 79 20 65 6c 65 6d 65 | 6e 74 2e 20 20 45 61 63 |by eleme|nt. Eac|
|000029f0| 68 20 74 69 6d 65 20 74 | 68 72 6f 75 67 68 0d 0a |h time t|hrough..|
|00002a00| 74 68 65 20 7b 5c 74 74 | 20 5e 7b 77 68 69 6c 65 |the {\tt| ^{while|
|00002a10| 7d 7d 20 6c 6f 6f 70 2c | 20 7b 5c 74 74 20 63 75 |}} loop,| {\tt cu|
|00002a20| 72 7d 20 69 73 20 72 65 | 70 6c 61 63 65 64 20 62 |r} is re|placed b|
|00002a30| 79 20 74 68 65 20 7b 5c | 74 74 20 63 64 72 7d 20 |y the {\|tt cdr} |
|00002a40| 6f 66 20 7b 5c 74 74 20 | 63 75 72 7d 2c 0d 0a 77 |of {\tt |cur},..w|
|00002a50| 68 69 63 68 20 69 73 20 | 74 68 65 20 6c 69 73 74 |hich is |the list|
|00002a60| 20 6d 69 6e 75 73 20 69 | 74 73 20 66 69 72 73 74 | minus i|ts first|
|00002a70| 20 65 6c 65 6d 65 6e 74 | 3b 20 74 68 65 20 6c 6f | element|; the lo|
|00002a80| 6f 70 0d 0a 66 69 6e 69 | 73 68 65 73 20 77 68 65 |op..fini|shes whe|
|00002a90| 6e 20 7b 5c 74 74 20 63 | 61 72 28 63 75 72 29 7d |n {\tt c|ar(cur)}|
|00002aa0| 20 69 73 20 7b 5c 74 74 | 20 6e 69 6c 7d 2c 0d 0a | is {\tt| nil},..|
|00002ab0| 77 68 69 63 68 20 6d 65 | 61 6e 73 20 74 68 61 74 |which me|ans that|
|00002ac0| 20 6e 6f 74 68 69 6e 67 | 20 69 73 20 6c 65 66 74 | nothing| is left|
|00002ad0| 20 69 6e 20 74 68 65 20 | 6c 69 73 74 0d 0a 28 7b | in the |list..({|
|00002ae0| 5c 74 74 20 5e 7b 6e 69 | 6c 7d 7d 20 69 73 20 61 |\tt ^{ni|l}} is a|
|00002af0| 20 73 70 65 63 69 61 6c | 20 64 61 74 61 74 79 70 | special| datatyp|
|00002b00| 65 20 77 68 69 63 68 20 | 6d 65 61 6e 73 2c 20 65 |e which |means, e|
|00002b10| 66 66 65 63 74 69 76 65 | 6c 79 2c 20 74 68 65 20 |ffective|ly, the |
|00002b20| 61 62 73 65 6e 63 65 20 | 6f 66 0d 0a 61 20 76 61 |absence |of..a va|
|00002b30| 6c 75 65 29 2e 20 20 41 | 20 7b 5c 74 74 20 77 68 |lue). A| {\tt wh|
|00002b40| 69 6c 65 7d 20 6c 6f 6f | 70 20 63 6f 6e 74 69 6e |ile} loo|p contin|
|00002b50| 75 65 73 0d 0a 75 6e 74 | 69 6c 20 69 74 73 20 63 |ues..unt|il its c|
|00002b60| 6f 6e 64 69 74 69 6f 6e | 20 69 73 20 65 69 74 68 |ondition| is eith|
|00002b70| 65 72 20 7a 65 72 6f 20 | 6f 72 20 7b 5c 74 74 20 |er zero |or {\tt |
|00002b80| 6e 69 6c 7d 2e 0d 0a 0d | 0a 4e 6f 74 65 20 74 68 |nil}....|.Note th|
|00002b90| 61 74 20 77 65 20 61 73 | 73 69 67 6e 65 64 20 74 |at we as|signed t|
|00002ba0| 68 65 20 6c 69 73 74 20 | 74 6f 20 61 20 6c 6f 63 |he list |to a loc|
|00002bb0| 61 6c 20 76 61 72 69 61 | 62 6c 65 20 62 65 66 6f |al varia|ble befo|
|00002bc0| 72 65 20 73 74 61 72 74 | 69 6e 67 20 74 68 65 20 |re start|ing the |
|00002bd0| 6c 6f 6f 70 2c 0d 0a 62 | 65 63 61 75 73 65 20 77 |loop,..b|ecause w|
|00002be0| 65 20 77 61 6e 74 20 74 | 6f 20 74 61 6b 65 20 74 |e want t|o take t|
|00002bf0| 68 65 20 6c 69 73 74 27 | 73 20 7b 5c 74 74 20 63 |he list'|s {\tt c|
|00002c00| 64 72 28 29 7d 20 65 61 | 63 68 20 74 69 6d 65 20 |dr()} ea|ch time |
|00002c10| 74 68 72 6f 75 67 68 20 | 74 68 65 20 6c 6f 6f 70 |through |the loop|
|00002c20| 3b 0d 0a 69 66 20 77 65 | 20 61 73 73 69 67 6e 65 |;..if we| assigne|
|00002c30| 64 20 74 68 69 73 20 74 | 6f 20 7b 5c 74 74 20 6c |d this t|o {\tt l|
|00002c40| 69 73 74 6f 62 6a 2e 6d | 79 6c 69 73 74 7d 20 65 |istobj.m|ylist} e|
|00002c50| 61 63 68 20 74 69 6d 65 | 2c 20 7b 5c 74 74 20 6c |ach time|, {\tt l|
|00002c60| 69 73 74 6f 62 6a 2e 6d | 79 6c 69 73 74 7d 0d 0a |istobj.m|ylist}..|
|00002c70| 77 6f 75 6c 64 20 65 6e | 64 20 75 70 20 77 69 74 |would en|d up wit|
|00002c80| 68 20 6e 6f 74 68 69 6e | 67 20 6c 65 66 74 20 77 |h nothin|g left w|
|00002c90| 68 65 6e 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e |hen the |function|
|00002ca0| 20 66 69 6e 69 73 68 65 | 64 2e 20 42 79 20 61 73 | finishe|d. By as|
|00002cb0| 73 69 67 6e 69 6e 67 20 | 74 68 65 0d 0a 6c 69 73 |signing |the..lis|
|00002cc0| 74 20 74 6f 20 74 68 65 | 20 6c 6f 63 61 6c 20 76 |t to the| local v|
|00002cd0| 61 72 69 61 62 6c 65 2c | 20 77 65 20 6c 65 61 76 |ariable,| we leav|
|00002ce0| 65 20 7b 5c 74 74 20 6c | 69 73 74 6f 62 6a 2e 6d |e {\tt l|istobj.m|
|00002cf0| 79 6c 69 73 74 7d 20 69 | 6e 74 61 63 74 2e 0d 0a |ylist} i|ntact...|
|00002d00| 0d 0a 54 68 65 73 65 20 | 61 72 65 20 73 6f 6d 65 |..These |are some|
|00002d10| 20 6f 66 20 74 68 65 20 | 62 61 73 69 63 20 64 61 | of the |basic da|
|00002d20| 74 61 74 79 70 65 73 20 | 6f 66 20 54 41 44 53 3a |tatypes |of TADS:|
|00002d30| 20 20 6e 75 6d 62 65 72 | 73 2c 20 73 74 72 69 6e | number|s, strin|
|00002d40| 67 73 20 28 65 6e 63 6c | 6f 73 65 64 0d 0a 69 6e |gs (encl|osed..in|
|00002d50| 20 73 69 6e 67 6c 65 20 | 71 75 6f 74 65 73 2c 20 | single |quotes, |
|00002d60| 77 68 69 63 68 20 61 72 | 65 20 73 69 6d 70 6c 79 |which ar|e simply|
|00002d70| 20 76 61 6c 75 65 73 20 | 70 61 73 73 65 64 20 61 | values |passed a|
|00002d80| 72 6f 75 6e 64 29 2c 20 | 70 72 69 6e 74 69 6e 67 |round), |printing|
|00002d90| 20 73 74 72 69 6e 67 73 | 0d 0a 28 65 6e 63 6c 6f | strings|..(enclo|
|00002da0| 73 65 64 20 69 6e 20 64 | 6f 75 62 6c 65 20 71 75 |sed in d|ouble qu|
|00002db0| 6f 74 65 73 2c 20 77 68 | 69 63 68 20 68 61 76 65 |otes, wh|ich have|
|00002dc0| 20 6e 6f 20 76 61 6c 75 | 65 20 62 75 74 20 61 72 | no valu|e but ar|
|00002dd0| 65 20 70 72 69 6e 74 65 | 64 20 77 68 65 6e 65 76 |e printe|d whenev|
|00002de0| 65 72 0d 0a 65 76 61 6c | 75 61 74 65 64 29 2c 20 |er..eval|uated), |
|00002df0| 6c 69 73 74 73 20 28 76 | 61 6c 75 65 73 20 65 6e |lists (v|alues en|
|00002e00| 63 6c 6f 73 65 64 20 69 | 6e 20 73 71 75 61 72 65 |closed i|n square|
|00002e10| 20 62 72 61 63 6b 65 74 | 73 29 2c 20 7b 5c 74 74 | bracket|s), {\tt|
|00002e20| 20 6e 69 6c 7d 20 61 6e | 64 0d 0a 7b 5c 74 74 20 | nil} an|d..{\tt |
|00002e30| 74 72 75 65 7d 20 28 72 | 65 74 75 72 6e 65 64 20 |true} (r|eturned |
|00002e40| 62 79 20 65 78 70 72 65 | 73 73 69 6f 6e 73 20 73 |by expre|ssions s|
|00002e50| 75 63 68 20 61 73 20 7b | 5c 74 74 20 31 20 3c 20 |uch as {|\tt 1 < |
|00002e60| 32 7d 29 2c 20 61 6e 64 | 20 6f 62 6a 65 63 74 73 |2}), and| objects|
|00002e70| 2e 0d 0a 41 20 70 72 6f | 70 65 72 74 79 20 63 61 |...A pro|perty ca|
|00002e80| 6e 20 68 61 76 65 20 61 | 6e 79 20 6f 66 20 74 68 |n have a|ny of th|
|00002e90| 65 73 65 20 64 61 74 61 | 74 79 70 65 73 2e 0d 0a |ese data|types...|
|00002ea0| 0d 0a 5c 6d 69 6e 6f 72 | 73 65 63 74 69 6f 6e 20 |..\minor|section |
|00002eb0| 4d 65 74 68 6f 64 73 0d | 0a 0d 0a 54 68 69 73 20 |Methods.|...This |
|00002ec0| 69 73 20 77 68 65 72 65 | 20 74 68 65 20 5e 7b 6f |is where| the ^{o|
|00002ed0| 62 6a 65 63 74 2d 6f 72 | 69 65 6e 74 65 64 7d 0d |bject-or|iented}.|
|00002ee0| 0a 6e 61 74 75 72 65 20 | 6f 66 20 74 68 69 73 20 |.nature |of this |
|00002ef0| 6c 61 6e 67 75 61 67 65 | 20 62 65 63 6f 6d 65 73 |language| becomes|
|00002f00| 20 6d 6f 72 65 20 76 69 | 73 69 62 6c 65 3a 20 20 | more vi|sible: |
|00002f10| 61 20 70 72 6f 70 65 72 | 74 79 20 63 61 6e 20 63 |a proper|ty can c|
|00002f20| 6f 6e 74 61 69 6e 20 63 | 6f 64 65 0d 0a 69 6e 73 |ontain c|ode..ins|
|00002f30| 74 65 61 64 20 6f 66 20 | 61 20 73 69 6d 70 6c 65 |tead of |a simple|
|00002f40| 20 64 61 74 61 20 69 74 | 65 6d 2e 0d 0a 57 68 65 | data it|em...Whe|
|00002f50| 6e 20 61 20 70 72 6f 70 | 65 72 74 79 20 63 6f 6e |n a prop|erty con|
|00002f60| 74 61 69 6e 73 20 63 6f | 64 65 2c 20 69 74 20 69 |tains co|de, it i|
|00002f70| 73 20 63 61 6c 6c 65 64 | 20 61 20 7b 5c 73 6c 20 |s called| a {\sl |
|00002f80| 5e 7b 6d 65 74 68 6f 64 | 7d 7d 2e 0d 0a 0d 0a 7b |^{method|}}.....{|
|00002f90| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 20 5c 6f |\example|.. \o|
|00002fa0| 62 6a 65 63 74 7b 6d 65 | 74 68 6f 64 4f 62 6a 3a |bject{me|thodObj:|
|00002fb0| 20 6f 62 6a 65 63 74 7d | 0d 0a 20 20 20 20 20 20 | object}|.. |
|00002fc0| 20 20 63 20 3d 0d 0a 09 | 5c 6c 62 0d 0a 09 20 20 | c =...|\lb... |
|00002fd0| 20 20 6c 6f 63 61 6c 20 | 69 3b 0d 0a 09 20 20 20 | local |i;... |
|00002fe0| 20 69 20 3a 3d 20 30 3b | 0d 0a 09 20 20 20 20 77 | i := 0;|... w|
|00002ff0| 68 69 6c 65 20 28 69 20 | 3c 20 31 30 30 29 0d 0a |hile (i |< 100)..|
|00003000| 09 20 20 20 20 5c 6c 62 | 0d 0a 09 20 20 20 20 20 |. \lb|... |
|00003010| 20 20 20 73 61 79 28 69 | 29 3b 20 22 20 22 3b 0d | say(i|); " ";.|
|00003020| 0a 09 09 69 20 3a 3d 20 | 69 2b 31 3b 0d 0a 09 20 |...i := |i+1;... |
|00003030| 20 20 20 5c 72 62 0d 0a | 09 20 20 20 20 72 65 74 | \rb..|. ret|
|00003040| 75 72 6e 28 27 74 68 61 | 74 20 69 73 20 61 6c 6c |urn('tha|t is all|
|00003050| 27 29 3b 0d 0a 20 20 20 | 20 20 20 20 20 5c 72 62 |');.. | \rb|
|00003060| 0d 0a 20 20 20 20 5c 65 | 6e 64 6f 62 6a 0d 0a 7d |.. \e|ndobj..}|
|00003070| 0d 0a 0d 0a 54 68 69 73 | 20 6f 62 6a 65 63 74 20 |....This| object |
|00003080| 69 73 20 63 6f 6e 73 69 | 64 65 72 61 62 6c 79 20 |is consi|derably |
|00003090| 6d 6f 72 65 20 63 6f 6d | 70 6c 69 63 61 74 65 64 |more com|plicated|
|000030a0| 20 74 68 61 6e 20 74 68 | 6f 73 65 20 77 65 20 68 | than th|ose we h|
|000030b0| 61 76 65 20 73 65 65 6e | 20 73 6f 20 66 61 72 2e |ave seen| so far.|
|000030c0| 0d 0a 54 68 65 20 6d 65 | 74 68 6f 64 20 7b 5c 74 |..The me|thod {\t|
|000030d0| 74 20 63 7d 20 69 73 20 | 61 20 73 65 74 20 6f 66 |t c} is |a set of|
|000030e0| 20 73 74 61 74 65 6d 65 | 6e 74 73 2c 20 77 68 69 | stateme|nts, whi|
|000030f0| 63 68 20 61 72 65 20 65 | 78 65 63 75 74 65 64 20 |ch are e|xecuted |
|00003100| 77 68 65 6e 65 76 65 72 | 0d 0a 7b 5c 74 74 20 6d |whenever|..{\tt m|
|00003110| 65 74 68 6f 64 4f 62 6a | 2e 63 7d 20 69 73 0d 0a |ethodObj|.c} is..|
|00003120| 65 76 61 6c 75 61 74 65 | 64 2e 20 20 54 68 65 20 |evaluate|d. The |
|00003130| 6d 65 74 68 6f 64 20 69 | 6e 20 74 68 69 73 20 63 |method i|n this c|
|00003140| 61 73 65 20 68 61 73 20 | 72 65 74 75 72 6e 65 64 |ase has |returned|
|00003150| 20 61 20 76 61 6c 75 65 | 2c 20 62 75 74 20 74 68 | a value|, but th|
|00003160| 69 73 20 69 73 20 6e 6f | 74 0d 0a 6e 65 63 65 73 |is is no|t..neces|
|00003170| 73 61 72 79 3b 20 71 75 | 69 74 65 20 6f 66 74 65 |sary; qu|ite ofte|
|00003180| 6e 2c 20 61 20 6d 65 74 | 68 6f 64 20 69 73 20 65 |n, a met|hod is e|
|00003190| 76 61 6c 75 61 74 65 64 | 20 73 74 72 69 63 74 6c |valuated| strictl|
|000031a0| 79 20 66 6f 72 20 69 74 | 73 20 73 69 64 65 20 65 |y for it|s side e|
|000031b0| 66 66 65 63 74 73 2c 0d | 0a 73 75 63 68 20 61 73 |ffects,.|.such as|
|000031c0| 20 61 20 6d 65 73 73 61 | 67 65 20 69 74 20 70 72 | a messa|ge it pr|
|000031d0| 69 6e 74 73 2e 0d 0a 0d | 0a 4e 6f 74 65 20 74 68 |ints....|.Note th|
|000031e0| 61 74 20 61 20 70 72 6f | 70 65 72 74 79 20 77 68 |at a pro|perty wh|
|000031f0| 6f 73 65 20 76 61 6c 75 | 65 20 69 73 20 61 20 5e |ose valu|e is a ^|
|00003200| 7b 64 6f 75 62 6c 65 2d | 71 75 6f 74 65 7d 0d 0a |{double-|quote}..|
|00003210| 73 74 72 69 6e 67 20 61 | 63 74 73 20 65 78 61 63 |string a|cts exac|
|00003220| 74 6c 79 20 6c 69 6b 65 | 20 61 0d 0a 6d 65 74 68 |tly like| a..meth|
|00003230| 6f 64 20 77 69 74 68 20 | 74 68 65 20 73 61 6d 65 |od with |the same|
|00003240| 20 64 6f 75 62 6c 65 2d | 71 75 6f 74 65 20 73 74 | double-|quote st|
|00003250| 72 69 6e 67 20 61 73 20 | 69 74 73 20 6f 6e 6c 79 |ring as |its only|
|00003260| 20 73 74 61 74 65 6d 65 | 6e 74 2c 20 73 6f 0d 0a | stateme|nt, so..|
|00003270| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 74 68 |the foll|owing th|
|00003280| 72 65 65 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |ree defi|nitions |
|00003290| 61 72 65 20 73 79 6e 6f | 6e 79 6d 6f 75 73 3a 0d |are syno|nymous:.|
|000032a0| 0a 0d 0a 7b 5c 65 78 61 | 6d 70 6c 65 0d 0a 20 20 |...{\exa|mple.. |
|000032b0| 20 20 5c 6f 62 6a 65 63 | 74 7b 73 74 72 69 6e 67 | \objec|t{string|
|000032c0| 31 3a 20 6f 62 6a 65 63 | 74 7d 0d 0a 20 20 20 20 |1: objec|t}.. |
|000032d0| 20 20 20 20 6d 79 53 74 | 72 69 6e 67 20 3d 20 22 | mySt|ring = "|
|000032e0| 54 68 69 73 20 69 73 20 | 61 20 73 74 72 69 6e 67 |This is |a string|
|000032f0| 2e 22 0d 0a 20 20 20 20 | 5c 65 6e 64 6f 62 6a 0d |.".. |\endobj.|
|00003300| 0a 20 20 20 20 0d 0a 20 | 20 20 20 5c 6f 62 6a 65 |. .. | \obje|
|00003310| 63 74 7b 73 74 72 69 6e | 67 32 3a 20 6f 62 6a 65 |ct{strin|g2: obje|
|00003320| 63 74 7d 0d 0a 20 20 20 | 20 20 20 20 20 6d 79 53 |ct}.. | myS|
|00003330| 74 72 69 6e 67 20 3d 0d | 0a 09 5c 6c 62 0d 0a 09 |tring =.|..\lb...|
|00003340| 20 20 20 20 22 54 68 69 | 73 20 69 73 20 61 20 73 | "Thi|s is a s|
|00003350| 74 72 69 6e 67 2e 22 3b | 0d 0a 09 5c 72 62 0d 0a |tring.";|...\rb..|
|00003360| 20 20 20 20 5c 65 6e 64 | 6f 62 6a 0d 0a 20 20 20 | \end|obj.. |
|00003370| 20 0d 0a 20 20 20 20 5c | 6f 62 6a 65 63 74 7b 73 | .. \|object{s|
|00003380| 74 72 69 6e 67 33 3a 20 | 6f 62 6a 65 63 74 7d 0d |tring3: |object}.|
|00003390| 0a 20 20 20 20 20 20 20 | 20 6d 79 53 74 72 69 6e |. | myStrin|
|000033a0| 67 20 3d 0d 0a 09 5c 6c | 62 0d 0a 09 20 20 20 20 |g =...\l|b... |
|000033b0| 73 61 79 28 27 54 68 69 | 73 20 69 73 20 61 20 73 |say('Thi|s is a s|
|000033c0| 74 72 69 6e 67 2e 27 29 | 3b 0d 0a 09 5c 72 62 0d |tring.')|;...\rb.|
|000033d0| 0a 20 20 20 20 5c 65 6e | 64 6f 62 6a 0d 0a 7d 0d |. \en|dobj..}.|
|000033e0| 0a 0d 0a 4e 6f 74 65 20 | 74 68 61 74 20 64 6f 75 |...Note |that dou|
|000033f0| 62 6c 65 2d 71 75 6f 74 | 65 20 73 74 72 69 6e 67 |ble-quot|e string|
|00003400| 73 20 64 6f 20 6e 6f 74 | 20 68 61 76 65 0d 0a 61 |s do not| have..a|
|00003410| 6e 79 20 76 61 6c 75 65 | 3b 20 74 68 65 69 72 20 |ny value|; their |
|00003420| 6f 6e 6c 79 20 66 75 6e | 63 74 69 6f 6e 20 69 73 |only fun|ction is|
|00003430| 20 74 68 61 74 20 74 68 | 65 69 72 20 65 76 61 6c | that th|eir eval|
|00003440| 75 61 74 69 6f 6e 20 64 | 69 73 70 6c 61 79 73 0d |uation d|isplays.|
|00003450| 0a 74 68 65 20 73 74 72 | 69 6e 67 2e 0d 0a 0d 0a |.the str|ing.....|
|00003460| 4c 69 6b 65 20 66 75 6e | 63 74 69 6f 6e 73 2c 20 |Like fun|ctions, |
|00003470| 6d 65 74 68 6f 64 73 20 | 63 61 6e 20 74 61 6b 65 |methods |can take|
|00003480| 20 5e 7b 61 72 67 75 6d | 65 6e 74 73 7d 2e 20 20 | ^{argum|ents}. |
|00003490| 54 6f 20 73 70 65 63 69 | 66 79 20 61 72 67 75 6d |To speci|fy argum|
|000034a0| 65 6e 74 73 2c 20 73 69 | 6d 70 6c 79 0d 0a 6c 69 |ents, si|mply..li|
|000034b0| 73 74 20 74 68 65 6d 20 | 61 73 20 79 6f 75 20 77 |st them |as you w|
|000034c0| 6f 75 6c 64 20 77 69 74 | 68 20 61 20 5e 7b 66 75 |ould wit|h a ^{fu|
|000034d0| 6e 63 74 69 6f 6e 7d 20 | 61 66 74 65 72 20 74 68 |nction} |after th|
|000034e0| 65 20 6d 65 74 68 6f 64 | 20 6e 61 6d 65 3b 20 74 |e method| name; t|
|000034f0| 68 65 79 20 61 63 74 0d | 0a 61 73 20 6c 6f 63 61 |hey act.|.as loca|
|00003500| 6c 20 76 61 72 69 61 62 | 6c 65 73 20 69 6e 73 69 |l variab|les insi|
|00003510| 64 65 20 74 68 65 20 6d | 65 74 68 6f 64 20 6a 75 |de the m|ethod ju|
|00003520| 73 74 20 61 73 20 66 75 | 6e 63 74 69 6f 6e 20 61 |st as fu|nction a|
|00003530| 72 67 75 6d 65 6e 74 73 | 20 64 6f 2e 0d 0a 0d 0a |rguments| do.....|
|00003540| 7b 5c 65 78 61 6d 70 6c | 65 0d 0a 20 20 20 20 5c |{\exampl|e.. \|
|00003550| 6f 62 6a 65 63 74 7b 61 | 72 67 4f 62 6a 3a 20 6f |object{a|rgObj: o|
|00003560| 62 6a 65 63 74 7d 0d 0a | 20 20 20 20 20 20 20 20 |bject}..| |
|00003570| 73 75 6d 28 61 2c 20 62 | 2c 20 63 29 20 3d 0d 0a |sum(a, b|, c) =..|
|00003580| 09 5c 6c 62 0d 0a 09 20 | 20 20 20 22 54 68 65 20 |.\lb... | "The |
|00003590| 73 75 6d 20 69 73 3a 20 | 22 3b 0d 0a 09 20 20 20 |sum is: |";... |
|000035a0| 20 73 61 79 28 61 20 2b | 20 62 20 2b 20 63 29 3b | say(a +| b + c);|
|000035b0| 0d 0a 09 20 20 20 20 22 | 5c 63 68 61 72 60 5c 5c |... "|\char`\\|
|000035c0| 6e 22 3b 0d 0a 09 5c 72 | 62 0d 0a 20 20 20 20 5c |n";...\r|b.. \|
|000035d0| 65 6e 64 6f 62 6a 0d 0a | 7d 0d 0a 0d 0a 54 6f 20 |endobj..|}....To |
|000035e0| 69 6e 76 6f 6b 65 20 61 | 20 6d 65 74 68 6f 64 20 |invoke a| method |
|000035f0| 77 69 74 68 20 61 72 67 | 75 6d 65 6e 74 73 2c 20 |with arg|uments, |
|00003600| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 20 76 61 6c |the argu|ment val|
|00003610| 75 65 73 20 61 72 65 20 | 65 6e 63 6c 6f 73 65 64 |ues are |enclosed|
|00003620| 20 69 6e 0d 0a 70 61 72 | 65 6e 74 68 65 73 65 73 | in..par|entheses|
|00003630| 20 61 6e 64 20 70 6c 61 | 63 65 64 20 61 66 74 65 | and pla|ced afte|
|00003640| 72 20 74 68 65 20 6d 65 | 74 68 6f 64 20 6e 61 6d |r the me|thod nam|
|00003650| 65 2c 20 6a 75 73 74 20 | 61 73 20 77 69 74 68 20 |e, just |as with |
|00003660| 61 20 66 75 6e 63 74 69 | 6f 6e 20 63 61 6c 6c 3a |a functi|on call:|
|00003670| 0d 0a 0d 0a 7b 5c 65 78 | 61 6d 70 6c 65 0d 0a 20 |....{\ex|ample.. |
|00003680| 20 20 20 61 72 67 4f 62 | 6a 2e 73 75 6d 28 31 2c | argOb|j.sum(1,|
|00003690| 20 32 2c 20 33 29 3b 0d | 0a 7d 0d 0a 0d 0a 5c 6d | 2, 3);.|.}....\m|
|000036a0| 69 6e 6f 72 73 65 63 74 | 69 6f 6e 20 49 6e 68 65 |inorsect|ion Inhe|
|000036b0| 72 69 74 61 6e 63 65 0d | 0a 0d 0a 0d 0a 4f 62 6a |ritance.|.....Obj|
|000036c0| 65 63 74 73 20 63 61 6e | 20 5e 7b 69 6e 68 65 72 |ects can| ^{inher|
|000036d0| 69 74 7d 20 70 72 6f 70 | 65 72 74 69 65 73 20 61 |it} prop|erties a|
|000036e0| 6e 64 20 6d 65 74 68 6f | 64 73 20 66 72 6f 6d 20 |nd metho|ds from |
|000036f0| 6f 74 68 65 72 20 6f 62 | 6a 65 63 74 73 2e 20 20 |other ob|jects. |
|00003700| 54 68 65 0d 0a 7b 5c 74 | 74 20 6f 62 6a 65 63 74 |The..{\t|t object|
|00003710| 7d 0d 0a 6b 65 79 77 6f | 72 64 20 64 65 66 69 6e |}..keywo|rd defin|
|00003720| 65 73 20 74 68 65 20 6d | 6f 73 74 20 67 65 6e 65 |es the m|ost gene|
|00003730| 72 61 6c 20 6b 69 6e 64 | 20 6f 66 20 6f 62 6a 65 |ral kind| of obje|
|00003740| 63 74 3b 20 69 6e 20 69 | 74 73 20 70 6c 61 63 65 |ct; in i|ts place|
|00003750| 2c 20 79 6f 75 20 63 61 | 6e 20 75 73 65 0d 0a 74 |, you ca|n use..t|
|00003760| 68 65 20 6e 61 6d 65 20 | 6f 66 20 61 6e 6f 74 68 |he name |of anoth|
|00003770| 65 72 20 6f 62 6a 65 63 | 74 2e 20 20 46 6f 72 20 |er objec|t. For |
|00003780| 65 78 61 6d 70 6c 65 2c | 0d 0a 0d 0a 7b 5c 65 78 |example,|....{\ex|
|00003790| 61 6d 70 6c 65 0d 0a 20 | 20 20 20 5c 6f 62 6a 65 |ample.. | \obje|
|000037a0| 63 74 7b 62 6f 6f 6b 3a | 20 6f 62 6a 65 63 74 7d |ct{book:| object}|
|000037b0| 0d 0a 20 20 20 20 20 20 | 20 20 77 65 69 67 68 74 |.. | weight|
|000037c0| 20 3d 20 31 20 20 20 20 | 5c 68 66 69 6c 6c 20 20 | = 1 |\hfill |
|000037d0| 2f 2f 20 42 6f 6f 6b 73 | 20 61 72 65 20 66 61 69 |// Books| are fai|
|000037e0| 72 6c 79 20 6c 69 67 68 | 74 0d 0a 20 20 20 20 5c |rly ligh|t.. \|
|000037f0| 65 6e 64 6f 62 6a 0d 0a | 20 20 20 20 0d 0a 20 20 |endobj..| .. |
|00003800| 20 20 5c 6f 62 6a 65 63 | 74 7b 72 65 64 62 6f 6f | \objec|t{redboo|
|00003810| 6b 3a 20 62 6f 6f 6b 7d | 0d 0a 20 20 20 20 20 20 |k: book}|.. |
|00003820| 20 20 64 65 73 63 72 69 | 70 74 69 6f 6e 20 3d 20 | descri|ption = |
|00003830| 22 54 68 69 73 20 69 73 | 20 61 20 72 65 64 20 62 |"This is| a red b|
|00003840| 6f 6f 6b 2e 22 0d 0a 20 | 20 20 20 5c 65 6e 64 6f |ook.".. | \endo|
|00003850| 62 6a 0d 0a 20 20 20 20 | 0d 0a 20 20 20 20 5c 6f |bj.. |.. \o|
|00003860| 62 6a 65 63 74 7b 62 6c | 75 65 62 6f 6f 6b 3a 20 |bject{bl|uebook: |
|00003870| 62 6f 6f 6b 7d 0d 0a 20 | 20 20 20 20 20 20 20 77 |book}.. | w|
|00003880| 65 69 67 68 74 20 3d 20 | 32 20 20 20 20 5c 68 66 |eight = |2 \hf|
|00003890| 69 6c 6c 20 20 2f 2f 20 | 41 20 68 65 61 76 69 65 |ill // |A heavie|
|000038a0| 72 2d 74 68 61 6e 2d 75 | 73 75 61 6c 20 62 6f 6f |r-than-u|sual boo|
|000038b0| 6b 0d 0a 09 64 65 73 63 | 72 69 70 74 69 6f 6e 20 |k...desc|ription |
|000038c0| 3d 20 22 54 68 69 73 20 | 69 73 20 61 20 62 69 67 |= "This |is a big|
|000038d0| 20 62 6c 75 65 20 62 6f | 6f 6b 2e 22 0d 0a 20 20 | blue bo|ok.".. |
|000038e0| 20 20 5c 65 6e 64 6f 62 | 6a 0d 0a 7d 0d 0a 0d 0a | \endob|j..}....|
|000038f0| 0d 0a 54 68 65 20 66 69 | 72 73 74 20 6f 62 6a 65 |..The fi|rst obje|
|00003900| 63 74 2c 20 7b 5c 74 74 | 20 62 6f 6f 6b 7d 2c 20 |ct, {\tt| book}, |
|00003910| 64 65 66 69 6e 65 73 20 | 61 20 67 65 6e 65 72 61 |defines |a genera|
|00003920| 6c 20 63 61 74 65 67 6f | 72 79 2e 20 20 7b 5c 74 |l catego|ry. {\t|
|00003930| 74 20 72 65 64 62 6f 6f | 6b 7d 0d 0a 64 65 66 69 |t redboo|k}..defi|
|00003940| 6e 65 73 20 61 0d 0a 70 | 61 72 74 69 63 75 6c 61 |nes a..p|articula|
|00003950| 72 20 62 6f 6f 6b 2c 20 | 77 68 69 63 68 20 6d 65 |r book, |which me|
|00003960| 61 6e 73 20 69 74 20 68 | 61 73 20 61 6c 6c 20 74 |ans it h|as all t|
|00003970| 68 65 20 70 72 6f 70 65 | 72 74 69 65 73 20 6f 66 |he prope|rties of|
|00003980| 20 61 20 62 6f 6f 6b 2c | 20 70 6c 75 73 20 61 6e | a book,| plus an|
|00003990| 79 0d 0a 74 68 61 74 20 | 61 72 65 20 73 70 65 63 |y..that |are spec|
|000039a0| 69 66 69 63 20 74 6f 20 | 69 74 2e 20 20 4c 69 6b |ific to |it. Lik|
|000039b0| 65 77 69 73 65 2c 20 7b | 5c 74 74 20 62 6c 75 65 |ewise, {|\tt blue|
|000039c0| 62 6f 6f 6b 7d 0d 0a 64 | 65 66 69 6e 65 73 20 61 |book}..d|efines a|
|000039d0| 20 64 69 66 66 65 72 65 | 6e 74 20 62 6f 6f 6b 2e | differe|nt book.|
|000039e0| 20 20 41 67 61 69 6e 2c | 20 69 74 20 68 61 73 20 | Again,| it has |
|000039f0| 61 6c 6c 20 74 68 65 20 | 67 65 6e 65 72 61 6c 20 |all the |general |
|00003a00| 70 72 6f 70 65 72 74 69 | 65 73 0d 0a 6f 66 20 61 |properti|es..of a|
|00003a10| 20 62 6f 6f 6b 3b 20 68 | 6f 77 65 76 65 72 2c 20 | book; h|owever, |
|00003a20| 73 69 6e 63 65 20 69 74 | 20 68 61 73 20 69 74 73 |since it| has its|
|00003a30| 20 6f 77 6e 20 7b 5c 74 | 74 20 77 65 69 67 68 74 | own {\t|t weight|
|00003a40| 7d 20 70 72 6f 70 65 72 | 74 79 2c 20 74 68 65 0d |} proper|ty, the.|
|00003a50| 0a 7b 5c 74 74 20 77 65 | 69 67 68 74 7d 20 70 72 |.{\tt we|ight} pr|
|00003a60| 6f 70 65 72 74 79 20 6f | 66 20 74 68 65 20 6d 6f |operty o|f the mo|
|00003a70| 72 65 0d 0a 67 65 6e 65 | 72 61 6c 20 62 6f 6f 6b |re..gene|ral book|
|00003a80| 20 6f 62 6a 65 63 74 20 | 69 73 20 69 67 6e 6f 72 | object |is ignor|
|00003a90| 65 64 2e 20 20 48 65 6e | 63 65 2c 20 7b 5c 74 74 |ed. Hen|ce, {\tt|
|00003aa0| 20 72 65 64 62 6f 6f 6b | 2e 77 65 69 67 68 74 7d | redbook|.weight}|
|00003ab0| 20 69 73 20 7b 5c 74 74 | 20 31 7d 2c 0d 0a 77 68 | is {\tt| 1},..wh|
|00003ac0| 65 72 65 61 73 20 7b 5c | 74 74 20 62 6c 75 65 62 |ereas {\|tt blueb|
|00003ad0| 6f 6f 6b 2e 77 65 69 67 | 68 74 7d 20 69 73 20 7b |ook.weig|ht} is {|
|00003ae0| 5c 74 74 20 32 7d 2e 0d | 0a 0d 0a 5c 6d 69 6e 6f |\tt 2}..|...\mino|
|00003af0| 72 73 65 63 74 69 6f 6e | 20 43 6c 61 73 73 65 73 |rsection| Classes|
|00003b00| 0d 0a 0d 0a 0d 0a 57 68 | 65 6e 20 61 6e 20 6f 62 |......Wh|en an ob|
|00003b10| 6a 65 63 74 20 69 6e 68 | 65 72 69 74 73 20 70 72 |ject inh|erits pr|
|00003b20| 6f 70 65 72 74 69 65 73 | 20 66 72 6f 6d 20 61 20 |operties| from a |
|00003b30| 73 65 63 6f 6e 64 20 6f | 62 6a 65 63 74 2c 20 74 |second o|bject, t|
|00003b40| 68 65 20 73 65 63 6f 6e | 64 20 6f 62 6a 65 63 74 |he secon|d object|
|00003b50| 0d 0a 69 73 20 63 61 6c | 6c 65 64 20 74 68 65 20 |..is cal|led the |
|00003b60| 66 69 72 73 74 20 6f 62 | 6a 65 63 74 27 73 20 7b |first ob|ject's {|
|00003b70| 5c 73 6c 20 5e 7b 73 75 | 70 65 72 63 6c 61 73 73 |\sl ^{su|perclass|
|00003b80| 7d 7d 2e 20 20 57 68 65 | 6e 20 61 6e 20 6f 62 6a |}}. Whe|n an obj|
|00003b90| 65 63 74 20 69 73 20 74 | 68 65 0d 0a 73 75 70 65 |ect is t|he..supe|
|00003ba0| 72 63 6c 61 73 73 20 6f | 66 20 6f 74 68 65 72 20 |rclass o|f other |
|00003bb0| 6f 62 6a 65 63 74 73 2c | 20 74 68 65 20 6f 62 6a |objects,| the obj|
|00003bc0| 65 63 74 20 69 73 20 63 | 61 6c 6c 65 64 20 61 20 |ect is c|alled a |
|00003bd0| 7b 5c 73 6c 20 5e 7b 63 | 6c 61 73 73 7d 7d 2e 20 |{\sl ^{c|lass}}. |
|00003be0| 20 53 6f 6d 65 0d 0a 6f | 62 6a 65 63 74 2d 6f 72 | Some..o|bject-or|
|00003bf0| 69 65 6e 74 65 64 20 6c | 61 6e 67 75 61 67 65 73 |iented l|anguages|
|00003c00| 20 6d 61 6b 65 20 61 20 | 73 74 72 6f 6e 67 20 64 | make a |strong d|
|00003c10| 69 73 74 69 6e 63 74 69 | 6f 6e 20 62 65 74 77 65 |istincti|on betwe|
|00003c20| 65 6e 20 6f 62 6a 65 63 | 74 73 20 61 6e 64 0d 0a |en objec|ts and..|
|00003c30| 63 6c 61 73 73 65 73 3b | 20 69 6e 20 54 41 44 53 |classes;| in TADS|
|00003c40| 2c 20 74 68 65 72 65 20 | 69 73 20 76 65 72 79 20 |, there |is very |
|00003c50| 6c 69 74 74 6c 65 20 64 | 69 66 66 65 72 65 6e 63 |little d|ifferenc|
|00003c60| 65 20 62 65 74 77 65 65 | 6e 20 74 68 65 20 74 77 |e betwee|n the tw|
|00003c70| 6f 2e 20 20 48 6f 77 65 | 76 65 72 2c 0d 0a 61 20 |o. Howe|ver,..a |
|00003c80| 7b 5c 74 74 20 63 6c 61 | 73 73 7d 20 6b 65 79 77 |{\tt cla|ss} keyw|
|00003c90| 6f 72 64 20 69 73 20 70 | 72 6f 76 69 64 65 64 20 |ord is p|rovided |
|00003ca0| 74 68 61 74 20 73 70 65 | 63 69 66 69 65 73 20 74 |that spe|cifies t|
|00003cb0| 68 61 74 20 61 6e 20 6f | 62 6a 65 63 74 20 69 73 |hat an o|bject is|
|00003cc0| 20 73 65 72 76 69 6e 67 | 0d 0a 73 74 72 69 63 74 | serving|..strict|
|00003cd0| 6c 79 20 61 73 20 61 20 | 63 6c 61 73 73 3b 20 7b |ly as a |class; {|
|00003ce0| 5c 74 74 20 62 6f 6f 6b | 7d 20 63 6f 75 6c 64 20 |\tt book|} could |
|00003cf0| 74 68 75 73 20 68 61 76 | 65 20 62 65 65 6e 20 64 |thus hav|e been d|
|00003d00| 65 66 69 6e 65 64 20 61 | 73 20 66 6f 6c 6c 6f 77 |efined a|s follow|
|00003d10| 73 3a 0d 0a 0d 0a 7b 5c | 65 78 61 6d 70 6c 65 0d |s:....{\|example.|
|00003d20| 0a 20 20 20 20 5c 6f 62 | 6a 65 63 74 7b 63 6c 61 |. \ob|ject{cla|
|00003d30| 73 73 20 62 6f 6f 6b 3a | 20 6f 62 6a 65 63 74 7d |ss book:| object}|
|00003d40| 0d 0a 20 20 20 20 20 20 | 20 20 6e 6f 75 6e 20 3d |.. | noun =|
|00003d50| 20 27 62 6f 6f 6b 27 20 | 27 74 65 78 74 27 0d 0a | 'book' |'text'..|
|00003d60| 20 20 20 20 20 20 20 20 | 77 65 69 67 68 74 20 3d | |weight =|
|00003d70| 20 31 20 20 20 20 5c 68 | 66 69 6c 6c 20 20 2f 2f | 1 \h|fill //|
|00003d80| 20 42 6f 6f 6b 73 20 61 | 72 65 20 66 61 69 72 6c | Books a|re fairl|
|00003d90| 79 20 6c 69 67 68 74 0d | 0a 20 20 20 20 5c 65 6e |y light.|. \en|
|00003da0| 64 6f 62 6a 0d 0a 7d 0d | 0a 0d 0a 54 68 65 20 6f |dobj..}.|...The o|
|00003db0| 6e 6c 79 20 74 69 6d 65 | 20 74 68 61 74 20 74 68 |nly time| that th|
|00003dc0| 65 20 7b 5c 74 74 20 63 | 6c 61 73 73 7d 20 6b 65 |e {\tt c|lass} ke|
|00003dd0| 79 77 6f 72 64 20 69 73 | 20 72 65 71 75 69 72 65 |yword is| require|
|00003de0| 64 20 69 73 20 77 68 65 | 6e 20 61 20 63 6c 61 73 |d is whe|n a clas|
|00003df0| 73 20 74 68 61 74 0d 0a | 69 73 20 6e 6f 74 20 69 |s that..|is not i|
|00003e00| 74 73 65 6c 66 20 61 6e | 20 6f 62 6a 65 63 74 20 |tself an| object |
|00003e10| 68 61 73 20 5e 7b 76 6f | 63 61 62 75 6c 61 72 79 |has ^{vo|cabulary|
|00003e20| 7d 20 77 6f 72 64 20 70 | 72 6f 70 65 72 74 69 65 |} word p|ropertie|
|00003e30| 73 20 6f 72 20 61 0d 0a | 7b 5c 74 74 20 5e 7b 6c |s or a..|{\tt ^{l|
|00003e40| 6f 63 61 74 69 6f 6e 7d | 7d 0d 0a 70 72 6f 70 65 |ocation}|}..prope|
|00003e50| 72 74 79 2e 20 20 54 68 | 65 20 7b 5c 74 74 20 63 |rty. Th|e {\tt c|
|00003e60| 6c 61 73 73 7d 20 73 70 | 65 63 69 66 69 63 61 74 |lass} sp|ecificat|
|00003e70| 69 6f 6e 20 70 72 65 76 | 65 6e 74 73 20 74 68 65 |ion prev|ents the|
|00003e80| 20 70 6c 61 79 65 72 20 | 63 6f 6d 6d 61 6e 64 0d | player |command.|
|00003e90| 0a 70 61 72 73 65 72 20 | 66 72 6f 6d 20 6d 69 73 |.parser |from mis|
|00003ea0| 74 61 6b 65 6e 6c 79 20 | 62 65 6c 69 65 76 69 6e |takenly |believin|
|00003eb0| 67 20 74 68 61 74 20 74 | 68 65 20 70 6c 61 79 65 |g that t|he playe|
|00003ec0| 72 20 6d 69 67 68 74 20 | 62 65 20 72 65 66 65 72 |r might |be refer|
|00003ed0| 72 69 6e 67 0d 0a 74 6f | 20 74 68 65 20 63 6c 61 |ring..to| the cla|
|00003ee0| 73 73 20 77 69 74 68 20 | 68 69 73 20 63 6f 6d 6d |ss with |his comm|
|00003ef0| 61 6e 64 73 2e 0d 0a 0d | 0a 5c 6d 69 6e 6f 72 73 |ands....|.\minors|
|00003f00| 65 63 74 69 6f 6e 20 4d | 75 6c 74 69 70 6c 65 20 |ection M|ultiple |
|00003f10| 49 6e 68 65 72 69 74 61 | 6e 63 65 0d 0a 0d 0a 0d |Inherita|nce.....|
|00003f20| 0a 41 6e 20 6f 62 6a 65 | 63 74 20 63 61 6e 20 69 |.An obje|ct can i|
|00003f30| 6e 68 65 72 69 74 20 70 | 72 6f 70 65 72 74 69 65 |nherit p|ropertie|
|00003f40| 73 20 66 72 6f 6d 20 6d | 6f 72 65 20 74 68 61 6e |s from m|ore than|
|00003f50| 20 6f 6e 65 20 6f 74 68 | 65 72 20 6f 62 6a 65 63 | one oth|er objec|
|00003f60| 74 2e 20 20 54 68 69 73 | 20 69 73 0d 0a 63 61 6c |t. This| is..cal|
|00003f70| 6c 65 64 20 7b 5c 73 6c | 20 5e 7b 6d 75 6c 74 69 |led {\sl| ^{multi|
|00003f80| 70 6c 65 20 69 6e 68 65 | 72 69 74 61 6e 63 65 7d |ple inhe|ritance}|
|00003f90| 7d 2e 20 20 49 74 20 63 | 6f 6d 70 6c 69 63 61 74 |}. It c|omplicat|
|00003fa0| 65 73 20 74 68 69 6e 67 | 73 20 63 6f 6e 73 69 64 |es thing|s consid|
|00003fb0| 65 72 61 62 6c 79 2c 0d | 0a 70 72 69 6d 61 72 69 |erably,.|.primari|
|00003fc0| 6c 79 20 62 65 63 61 75 | 73 65 20 69 74 20 63 61 |ly becau|se it ca|
|00003fd0| 6e 20 62 65 20 63 6f 6e | 66 75 73 69 6e 67 20 74 |n be con|fusing t|
|00003fe0| 6f 20 66 69 67 75 72 65 | 20 6f 75 74 20 65 78 61 |o figure| out exa|
|00003ff0| 63 74 6c 79 20 77 68 65 | 72 65 20 61 6e 20 6f 62 |ctly whe|re an ob|
|00004000| 6a 65 63 74 0d 0a 69 73 | 20 69 6e 68 65 72 69 74 |ject..is| inherit|
|00004010| 69 6e 67 20 69 74 73 20 | 70 72 6f 70 65 72 74 69 |ing its |properti|
|00004020| 65 73 20 66 72 6f 6d 2e | 20 20 49 6e 20 65 73 73 |es from.| In ess|
|00004030| 65 6e 63 65 2c 20 74 68 | 65 20 6f 72 64 65 72 20 |ence, th|e order |
|00004040| 69 6e 20 77 68 69 63 68 | 20 79 6f 75 0d 0a 73 70 |in which| you..sp|
|00004050| 65 63 69 66 79 20 61 6e | 20 6f 62 6a 65 63 74 27 |ecify an| object'|
|00004060| 73 20 73 75 70 65 72 63 | 6c 61 73 73 65 73 20 64 |s superc|lasses d|
|00004070| 65 74 65 72 6d 69 6e 65 | 73 20 74 68 65 20 70 72 |etermine|s the pr|
|00004080| 69 6f 72 69 74 79 20 6f | 66 20 69 6e 68 65 72 69 |iority o|f inheri|
|00004090| 74 61 6e 63 65 0d 0a 69 | 66 20 74 68 65 20 6f 62 |tance..i|f the ob|
|000040a0| 6a 65 63 74 20 63 6f 75 | 6c 64 20 69 6e 68 65 72 |ject cou|ld inher|
|000040b0| 69 74 20 74 68 65 20 73 | 61 6d 65 20 70 72 6f 70 |it the s|ame prop|
|000040c0| 65 72 74 79 20 66 72 6f | 6d 20 73 65 76 65 72 61 |erty fro|m severa|
|000040d0| 6c 20 6f 66 20 69 74 73 | 0d 0a 73 75 70 65 72 63 |l of its|..superc|
|000040e0| 6c 61 73 73 65 73 2e 0d | 0a 0d 0a 7b 5c 65 78 61 |lasses..|...{\exa|
|000040f0| 6d 70 6c 65 0d 0a 20 20 | 20 20 5c 6f 62 6a 65 63 |mple.. | \objec|
|00004100| 74 7b 6d 75 6c 74 69 4f | 62 6a 3a 20 63 6c 61 73 |t{multiO|bj: clas|
|00004110| 73 31 2c 20 63 6c 61 73 | 73 32 2c 20 63 6c 61 73 |s1, clas|s2, clas|
|00004120| 73 33 7d 0d 0a 20 20 20 | 20 5c 65 6e 64 6f 62 6a |s3}.. | \endobj|
|00004130| 0d 0a 7d 0d 0a 0d 0a 48 | 65 72 65 20 77 65 20 68 |..}....H|ere we h|
|00004140| 61 76 65 20 64 65 66 69 | 6e 65 64 20 7b 5c 74 74 |ave defi|ned {\tt|
|00004150| 20 6d 75 6c 74 69 4f 62 | 6a 7d 20 74 6f 20 69 6e | multiOb|j} to in|
|00004160| 68 65 72 69 74 20 70 72 | 6f 70 65 72 74 69 65 73 |herit pr|operties|
|00004170| 20 66 69 72 73 74 20 66 | 72 6f 6d 20 7b 5c 74 74 | first f|rom {\tt|
|00004180| 0d 0a 63 6c 61 73 73 31 | 7d 2c 20 74 68 65 6e 20 |..class1|}, then |
|00004190| 66 72 6f 6d 20 7b 5c 74 | 74 20 63 6c 61 73 73 32 |from {\t|t class2|
|000041a0| 7d 2c 20 74 68 65 6e 20 | 66 72 6f 6d 20 7b 5c 74 |}, then |from {\t|
|000041b0| 74 20 63 6c 61 73 73 33 | 7d 2e 20 20 49 66 20 61 |t class3|}. If a|
|000041c0| 6c 6c 20 74 68 72 65 65 | 0d 0a 63 6c 61 73 73 65 |ll three|..classe|
|000041d0| 73 20 64 65 66 69 6e 65 | 20 61 20 70 72 6f 70 65 |s define| a prope|
|000041e0| 72 74 79 20 7b 5c 74 74 | 20 70 72 6f 70 31 7d 2c |rty {\tt| prop1},|
|000041f0| 20 7b 5c 74 74 20 6d 75 | 6c 74 69 4f 62 6a 7d 20 | {\tt mu|ltiObj} |
|00004200| 69 6e 68 65 72 69 74 73 | 20 7b 5c 74 74 20 70 72 |inherits| {\tt pr|
|00004210| 6f 70 31 7d 0d 0a 66 72 | 6f 6d 20 7b 5c 74 74 20 |op1}..fr|om {\tt |
|00004220| 63 6c 61 73 73 31 7d 2c | 20 73 69 6e 63 65 20 69 |class1},| since i|
|00004230| 74 20 69 73 20 73 70 65 | 63 69 66 69 65 64 20 66 |t is spe|cified f|
|00004240| 69 72 73 74 2e 0d 0a 0d | 0a 4d 75 6c 74 69 70 6c |irst....|.Multipl|
|00004250| 65 20 69 6e 68 65 72 69 | 74 61 6e 63 65 20 69 73 |e inheri|tance is|
|00004260| 20 75 73 65 64 20 6f 6e | 6c 79 20 72 61 72 65 6c | used on|ly rarel|
|00004270| 79 2c 20 62 75 74 20 79 | 6f 75 20 77 69 6c 6c 20 |y, but y|ou will |
|00004280| 66 69 6e 64 20 74 68 61 | 74 20 6f 6e 63 65 0d 0a |find tha|t once..|
|00004290| 69 6e 20 61 20 77 68 69 | 6c 65 20 69 74 20 69 73 |in a whi|le it is|
|000042a0| 20 61 20 76 65 72 79 20 | 75 73 65 66 75 6c 20 66 | a very |useful f|
|000042b0| 65 61 74 75 72 65 2e 20 | 20 46 6f 72 20 65 78 61 |eature. | For exa|
|000042c0| 6d 70 6c 65 2c 0d 0a 73 | 75 70 70 6f 73 65 20 79 |mple,..s|uppose y|
|000042d0| 6f 75 20 77 61 6e 74 65 | 64 20 74 6f 20 64 65 66 |ou wante|d to def|
|000042e0| 69 6e 65 20 61 20 68 75 | 67 65 20 76 61 73 65 3b |ine a hu|ge vase;|
|000042f0| 20 69 74 20 73 68 6f 75 | 6c 64 20 62 65 20 66 69 | it shou|ld be fi|
|00004300| 78 65 64 20 69 6e 20 74 | 68 65 20 72 6f 6f 6d 2c |xed in t|he room,|
|00004310| 0d 0a 73 69 6e 63 65 20 | 69 74 20 69 73 20 74 6f |..since |it is to|
|00004320| 6f 20 68 65 61 76 79 20 | 74 6f 20 63 61 72 72 79 |o heavy |to carry|
|00004330| 2c 20 62 75 74 20 69 74 | 20 73 68 6f 75 6c 64 20 |, but it| should |
|00004340| 61 6c 73 6f 20 62 65 20 | 61 20 63 6f 6e 74 61 69 |also be |a contai|
|00004350| 6e 65 72 2e 20 20 57 69 | 74 68 0d 0a 6d 75 6c 74 |ner. Wi|th..mult|
|00004360| 69 70 6c 65 20 69 6e 68 | 65 72 69 74 61 6e 63 65 |iple inh|eritance|
|00004370| 2c 20 79 6f 75 20 63 61 | 6e 20 64 65 66 69 6e 65 |, you ca|n define|
|00004380| 20 74 68 65 20 6f 62 6a | 65 63 74 20 74 6f 20 62 | the obj|ect to b|
|00004390| 65 20 62 6f 74 68 20 61 | 20 7b 5c 74 74 20 66 69 |e both a| {\tt fi|
|000043a0| 78 65 64 69 74 65 6d 7d | 0d 0a 61 6e 64 20 61 20 |xeditem}|..and a |
|000043b0| 7b 5c 74 74 20 63 6f 6e | 74 61 69 6e 65 72 7d 20 |{\tt con|tainer} |
|000043c0| 28 77 68 69 63 68 20 61 | 72 65 20 63 6c 61 73 73 |(which a|re class|
|000043d0| 65 73 20 64 65 66 69 6e | 65 64 20 69 6e 20 7b 5c |es defin|ed in {\|
|000043e0| 74 74 20 61 64 76 2e 74 | 7d 29 2e 0d 0a 0d 0a 5c |tt adv.t|}).....\|
|000043f0| 65 6e 64 63 68 61 70 74 | 65 72 0d 0a 0d 0a 54 6f |endchapt|er....To|
|00004400| 20 63 68 61 6e 67 65 20 | 79 6f 75 72 20 6c 61 6e | change |your lan|
|00004410| 67 75 61 67 65 2c 0d 0a | 79 6f 75 20 6d 75 73 74 |guage,..|you must|
|00004420| 20 63 68 61 6e 67 65 20 | 79 6f 75 72 20 6c 69 66 | change |your lif|
|00004430| 65 2e 0d 0a 5c 61 75 74 | 68 6f 72 20 44 45 52 45 |e...\aut|hor DERE|
|00004440| 4b 20 57 41 4c 43 4f 54 | 54 2c 20 7b 5c 73 6c 20 |K WALCOT|T, {\sl |
|00004450| 43 6f 64 69 63 69 6c 5c | 2f 7d 20 28 31 39 36 35 |Codicil\|/} (1965|
|00004460| 29 0d 0a 0d 0a 5c 65 6a | 65 63 74 0d 0a |)....\ej|ect.. |
+--------+-------------------------+-------------------------+--------+--------+